/* Library report page (/library/<slug>/). Recreates
   docs/design_handoff/library_report/Library Report.dc.html with the app's
   design tokens. Page-scoped `librep-*` classes. */

.es-page.librep-page {
  max-width: 1120px;
  padding: 44px 40px 88px;
}

.librep-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 22px;
}
.librep-back:hover { color: var(--text-secondary); }
.librep-back span { font-size: 14px; }

/* --- header + seal --- */
.librep-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
}
.librep-header-main { flex: 1; min-width: 260px; }
.librep-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.librep-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 13px 0 0;
}
.librep-verdict {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 14px 0 0;
  max-width: 600px;
  text-wrap: pretty;
}
.librep-seal {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding-top: 6px;
}
.librep-seal-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
}
.librep-seal.is-verified .librep-seal-label { color: var(--accent); }
.librep-seal.is-slow .librep-seal-label { color: var(--warn); }
.librep-seal.is-busted .librep-seal-label { color: var(--down); }
.librep-seal-sub {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.24em;
  color: var(--text-muted);
}

/* --- hero metric row --- */
.librep-hero {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 28px;
}
.librep-hero-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.librep-hero-cell.is-lead {
  background: var(--down-soft);
  border-color: rgba(255, 95, 109, 0.42);
}
.librep-hero-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.librep-hero-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.librep-hero-cell.is-lead .librep-hero-val { font-size: 40px; }
.tone-up .librep-hero-val, .librep-hero-val.tone-up { color: var(--accent); }
.tone-down .librep-hero-val, .librep-hero-val.tone-down { color: var(--down); }

/* --- honesty strips --- */
.librep-reality.is-collapsed { display: none; }
.librep-reality {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 14px;
  padding: 16px 20px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
.librep-reality-figs { display: flex; align-items: baseline; gap: 18px; flex: none; }
.librep-reality-fig { display: flex; flex-direction: column; gap: 4px; }
.librep-reality-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.librep-reality-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 22px;
}
.librep-reality-val.is-strat { color: var(--accent); }
.librep-reality-val.is-bh { color: var(--text-secondary); }
.librep-reality-vs {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  align-self: center;
}
.librep-reality-note {
  flex: 1;
  min-width: 240px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  text-wrap: pretty;
}
.librep-why {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 14px;
  padding: 16px 19px;
  background: var(--warn-soft);
  border: 1px solid rgba(255, 180, 84, 0.3);
  border-radius: var(--radius-lg);
}
.librep-why svg { flex: none; margin-top: 2px; }
.librep-why-head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--warn);
  font-weight: 600;
}
.librep-why-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 8px 0 0;
  max-width: 640px;
  text-wrap: pretty;
}

/* --- panels --- */
.librep-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
}
.librep-panel-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* --- equity chart --- */
.librep-chart { margin-top: 26px; padding: 20px 22px 22px; }
.librep-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
/* vs buy & hold toggle switch (default off) */
.librep-bh-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.librep-bh-track {
  width: 30px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-well);
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.librep-bh-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.librep-bh-toggle[aria-checked="true"] { color: var(--text-secondary); }
.librep-bh-toggle[aria-checked="true"] .librep-bh-track {
  background: var(--accent-tint);
  border-color: var(--border-accent);
}
.librep-bh-toggle[aria-checked="true"] .librep-bh-thumb {
  transform: translateX(14px);
  background: var(--accent);
}
.librep-chart-box {
  width: 100%;
  height: 300px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.librep-chart-foot {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 12px 0 0;
}
.librep-shimmer {
  height: 300px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(90deg, var(--surface-well) 0%, rgba(255, 255, 255, 0.045) 50%, var(--surface-well) 100%);
  background-size: 680px 100%;
  animation: librep-shimmer 1.6s linear infinite;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
@keyframes librep-shimmer {
  from { background-position: -680px 0; }
  to { background-position: 680px 0; }
}
.librep-shimmer-note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- fold table --- */
.librep-folds { margin-top: 22px; padding: 6px 8px 8px; overflow-x: auto; }
.librep-folds-inner { min-width: 520px; }
.librep-fold-head,
.librep-fold-row {
  display: grid;
  grid-template-columns: 0.7fr 1.7fr 1fr 1fr 1fr;
}
.librep-fold-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.librep-fold-head span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.librep-fold-row { align-items: center; padding: 13px 16px; border-top: 1px solid var(--border-subtle); }
.librep-fold-row .ar, .librep-fold-head .ar { text-align: right; }
.librep-fold-num { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--text-primary); }
.librep-fold-win { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.librep-fold-row .ar {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-secondary);
}
.librep-fold-row .ar.tone-up { color: var(--accent); font-weight: 600; }
.librep-fold-row .ar.tone-down { color: var(--down); font-weight: 600; }
.librep-fold-caption {
  padding: 12px 16px 10px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- market matrix --- */
.librep-matrix-sec { margin-top: 32px; }
.librep-matrix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.librep-mx-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  white-space: nowrap;
}
.librep-matrix-caption {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 10px 0 16px;
  max-width: 600px;
  text-wrap: pretty;
}
.librep-matrix { overflow: hidden; }
.librep-mx-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-subtle);
}
.librep-mx-row:first-child { border-top: none; }
.librep-mx-sym { display: flex; align-items: center; gap: 10px; width: 130px; flex: none; }
.librep-mx-sym > span:first-child { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.librep-mx-shipped {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--accent-tint);
  border: 1px solid var(--border-accent);
  color: var(--accent);
}
.librep-mx-track {
  flex: 1;
  height: 6px;
  background: var(--surface-well);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.librep-mx-bar { height: 100%; background: var(--slate-600); border-radius: var(--radius-pill); }
.librep-mx-bar.is-on { background: var(--accent); }
.librep-mx-num {
  flex: none;
  width: 74px;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.librep-mx-num.is-on { color: var(--accent); }
.librep-mx-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 78px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.librep-mx-pill.is-on { color: var(--accent); }
.librep-mx-row.is-insufficient .librep-mx-sym > span:first-child,
.librep-mx-row.is-insufficient .librep-mx-num { color: var(--text-muted); }
.librep-mx-more { border-top: 1px solid var(--border-subtle); }
.librep-mx-more > summary {
  padding: 13px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.librep-mx-more > summary::-webkit-details-marker { display: none; }
.librep-mx-more > summary::after { content: " +"; color: var(--text-muted); }
.librep-mx-more[open] > summary::after { content: " −"; }
.librep-mx-more[open] > summary { border-bottom: 1px solid var(--border-subtle); }
.librep-mx-more .librep-mx-row:first-of-type { border-top: none; }

/* --- rules --- */
.librep-rules { margin-top: 32px; padding: 24px 24px 22px; }
.librep-rule-rows { display: flex; flex-direction: column; margin-top: 16px; }
.librep-rule { display: flex; gap: 18px; padding: 13px 0; border-top: 1px solid var(--border-subtle); }
.librep-rule:first-child { border-top: none; }
.librep-rule-label {
  flex: none;
  width: 78px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 2px;
}
.librep-rule-text { flex: 1; font-size: 14px; line-height: 1.6; color: var(--text-secondary); text-wrap: pretty; }

/* --- diagnosis --- */
.librep-diagnosis {
  margin-top: 22px;
  padding: 18px 22px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.librep-dg-label { color: var(--text-muted); font-size: 9.5px; letter-spacing: 0.16em; }
.librep-dg-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 10px 0 0;
  max-width: 680px;
  text-wrap: pretty;
}

/* --- adopt band --- */
.librep-adopt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 34px;
  padding: 22px 24px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  flex-wrap: wrap;
}
.librep-adopt.is-survivor { border-color: var(--border-accent); box-shadow: var(--glow-sm); }
.librep-adopt-copy { flex: 1; min-width: 240px; }
.librep-adopt-h { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.librep-adopt-p { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 7px 0 0; max-width: 440px; }
.librep-btn-adopt {
  flex: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 26px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  border: none;
  color: var(--text-on-accent);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--glow-sm);
}
.librep-btn-ghost {
  flex: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}
.librep-in-stack {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
}
.librep-to-today {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --- footer --- */
.librep-disclaimer {
  margin-top: 34px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--slate-700, var(--text-faint));
}

@media (max-width: 720px) {
  .es-page.librep-page { padding: 20px 16px 40px; }
  .librep-hero { grid-template-columns: repeat(2, 1fr); }
  .librep-hero-cell.is-lead { grid-column: span 2; }
  .librep-adopt { position: sticky; bottom: 12px; }
}

/* --- methodology link + related setups (public report only) --- */
.librep-method-link {
  margin-top: 30px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.librep-method-link a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.librep-method-link a:hover { border-bottom-color: var(--accent); }

.librep-related { margin-top: 40px; }
.librep-related-h {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.librep-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.librep-related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 120ms ease;
}
.librep-related-card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-subtle)); }
.librep-related-card.is-busted:hover { border-color: color-mix(in srgb, var(--down) 55%, var(--border-subtle)); }
.librep-related-fam {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.librep-related-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}
.librep-related-stat {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.librep-related-card.is-busted .librep-related-stat { color: var(--down); }
