/* Keyword library (/keywords/library).
   Only the parts site-keywords.css does not already style: the summary strip, the preset
   nav, and the few library-only cells. Every colour is a design token; the registration
   state reuses .explorer-status, so it is never conveyed by colour alone. */

.library-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
}

.library-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.library-stat dt {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--foreground-secondary);
}

.library-stat dd {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  min-width: 0;
}

.library-stat-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow-wrap: anywhere;
}

.library-stat-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---- Preset nav: one row of links, the current one marked with a border and weight ---- */
.library-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.library-preset {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--foreground-secondary);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.library-preset:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.library-preset:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.library-preset.is-active {
  border-color: var(--primary);
  background: var(--primary-subtle);
  color: var(--primary);
}

/* ---- Cells ---- */
.library-view { margin: 0 0 10px; font-size: var(--fs-xs); }
.library-bucket { white-space: nowrap; color: var(--foreground-secondary); font-size: var(--fs-xs); }
.library-axis {
  max-width: 160px;
  color: var(--foreground-secondary);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-month { display: block; font-size: var(--fs-xs); color: var(--muted); }
.library-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.library-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background-secondary);
  color: var(--foreground-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.library-table { min-width: 1180px; }

@media (max-width: 720px) {
  .library-presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .library-stat { padding: 10px 12px; }
  .library-stat-value { font-size: var(--fs-lg); }
}
