/* Library screen. Recreates docs/design_handoff/library/Library v2.dc.html
   using the app's design tokens (static/css/tokens.css). Page-scoped `lib-*`
   classes so it can't leak into other screens. */

/* Widen the shared page wrapper to the design's 1120px; base .es-page caps at
   1040 and pads 36/32/96, so restate both here to match the mockup exactly. */
.es-page.lib-page {
  max-width: 1120px;
  padding: 44px 40px 88px;
}

/* --- header band --- */
.lib-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.lib-eyebrow.is-down { color: var(--down); }

.lib-head { margin-bottom: 30px; }
.lib-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 14px 0 0;
}
.lib-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 27px;
  letter-spacing: -0.02em;
  margin: 12px 0 0;
}
.lib-subline {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 15px 0 0;
  max-width: 620px;
  text-wrap: pretty;
}

/* --- new-user banner --- */
.lib-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  margin-bottom: 26px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  animation: lib-fade var(--dur-med) var(--ease-out);
}
.lib-banner-arrow { flex: none; color: var(--accent); }
.lib-banner-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-secondary); }
.lib-banner-x {
  flex: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
}
.lib-banner-x:hover { color: var(--text-primary); }

@keyframes lib-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- filter chips --- */
.lib-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.lib-filter-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-filters-ticker { margin-top: 10px; margin-bottom: 20px; }
.lib-chip {
  cursor: pointer;
  height: 32px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.lib-chip.is-active {
  background: var(--accent-tint);
  border-color: var(--border-accent);
  color: var(--accent);
}
.lib-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.lib-empty {
  padding: 28px 22px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* --- the shelf --- */
.lib-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.lib-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: 22px 22px 20px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.lib-card:hover { border-color: var(--border-accent); }
.lib-card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
/* the action row (adopt button + full-report link) must stay above the overlay */
.lib-card .lib-actions { position: relative; z-index: 2; }

.lib-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lib-family {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.lib-verdict-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lib-verdict-chip.is-real { color: var(--accent); }
.lib-verdict-chip.is-slow { color: var(--warn); }

.lib-card-name-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.lib-card-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lib-card-market {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.lib-card-rules {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 12px 0 0;
  text-wrap: pretty;
}

.lib-metrics {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.lib-metric { display: flex; flex-direction: column; gap: 3px; }
.lib-metric-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.lib-metric-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.lib-metric-value.is-down { color: var(--down); }
.lib-metric-value.is-up { color: var(--accent); }

.lib-verdict-line {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 16px;
}
.lib-caveat {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 13px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
}
.lib-caveat svg { flex: none; margin-top: 1px; }
.lib-caveat span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--warn);
}

.lib-edge-held {
  margin-top: 14px;
  cursor: default;
}
.lib-edge-held-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.lib-actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lib-adopt-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  border: none;
  color: var(--text-on-accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--glow-sm);
}
.lib-adopted {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.lib-report-form { margin: 0; }
.lib-report-link {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
.lib-report-link:hover { color: var(--text-secondary); }

/* --- methodology strip --- */
.lib-method {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 28px;
  padding: 16px 22px;
  background: var(--surface-well);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
.lib-method-item { display: flex; align-items: baseline; gap: 9px; }
.lib-method-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  flex: none;
}
.lib-method-text { font-size: 12.5px; color: var(--text-secondary); }

/* --- tested and busted --- */
.lib-busted-sec { margin-top: 52px; }
.lib-busted-list {
  display: flex;
  flex-direction: column;
  margin-top: 24px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}
.lib-busted-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.lib-busted-row:first-child { border-top: none; }
.lib-busted-tag {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--down);
}
.lib-busted-mid { flex: 1; min-width: 240px; }
.lib-busted-name-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lib-busted-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lib-busted-myth { font-size: 12.5px; color: var(--text-muted); }
.lib-busted-receipt {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 7px;
  max-width: 520px;
  text-wrap: pretty;
}
.lib-busted-stat { flex: none; text-align: right; }
.lib-busted-stat-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.lib-busted-stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
  color: var(--down);
}
.lib-busted-form { flex: none; margin: 0; }
.lib-busted-link {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-strong);
}
.lib-busted-link:hover { color: var(--text-secondary); }

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

@media (max-width: 720px) {
  .lib { padding: 32px 20px 64px; }
  .lib-shelf { grid-template-columns: 1fr; }
}
