/* ── Page header ────────────────────────────────────────────────────────── */
.history-header {
  margin-bottom: 1.5rem;
  text-align: center;
}
.history-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}
.history-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ── Grid ───────────────────────────────────────────────────────────────── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}
.history-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* Make the whole card a single clickable link */
.history-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

/* ── Image ──────────────────────────────────────────────────────────────── */
.history-card-img-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-surface, #1e1e1e);
  position: relative;
}
.history-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}
.history-card:hover .history-card-img {
  transform: scale(1.04);
}
.history-card-img--fallback .history-card-img {
  object-fit: contain;
  padding: 1.5rem;
  opacity: 0.35;
}

/* ── Body ───────────────────────────────────────────────────────────────── */
.history-card-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.4rem;
}

/* ── Site badge ─────────────────────────────────────────────────────────── */
.history-card-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 4px;
  padding: 2px 7px;
  align-self: flex-start;
}

/* ── Title ──────────────────────────────────────────────────────────────── */
.history-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Meta pills ─────────────────────────────────────────────────────────── */
.history-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.hc-pill {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--bg-surface, rgba(255,255,255,0.06));
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ── Date ───────────────────────────────────────────────────────────────── */
.history-card-date {
  font-size: 0.72rem;
  color: var(--text-muted, var(--text-secondary));
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.history-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}
.history-empty a {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Auth gate ──────────────────────────────────────────────────────────── */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1rem;
  max-width: 500px;
  margin: 0 auto;
}
.auth-gate h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.auth-gate p {
  margin-bottom: 2rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .history-grid {
    grid-template-columns: 1fr;
  }
}
