/* components.css — buttons, cards, badges, tags, bars */

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  transition: border-color 120ms ease, transform 120ms ease;
}
.card.is-link {
  cursor: pointer;
  display: block;
  color: inherit;
}
.card.is-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--bg-elev-2); border-color: var(--accent); text-decoration: none; }
.btn.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--on-accent);
}
.btn.primary:hover {
  background: color-mix(in srgb, var(--accent-2) 88%, var(--fg-strong));
  border-color: color-mix(in srgb, var(--accent-2) 88%, var(--fg-strong));
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}
.btn.ghost:hover { color: var(--fg); background: var(--bg-elev); border-color: var(--border-soft); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.78rem; }

/* ── Copy / share buttons ─────────────────────────────────────
   Cross-view affordance for "copy a URL to the clipboard".  Compose
   with any base button class (`.btn`, `.cmp-basket-share`, etc.) — this
   class only adds the icon spacing and the success / failure flash
   chrome that runs after `flashButtonLabel(btn, …, { className: "is-copied"|"is-copy-failed" })`. */
.copy-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.copy-btn-icon {
  font-size: 0.95em;
  line-height: 1;
  display: inline-block;
  transform: translateY(-1px);
  opacity: 0.85;
}
.copy-btn.is-copied {
  color: var(--good, #16a34a);
  border-color: var(--good, #16a34a);
  background: color-mix(in srgb, var(--good, #16a34a) 10%, transparent);
}
.copy-btn.is-copy-failed {
  color: var(--bad, #dc2626);
  border-color: var(--bad, #dc2626);
  background: color-mix(in srgb, var(--bad, #dc2626) 10%, transparent);
}

/* ── Chart download button ────────────────────────────────────
   Tiny icon button placed at the top-right corner of any chart
   wrapper.  Position the wrapper `position: relative` and drop a
   `<button class="chart-dl-btn">` inside; the helper in utils.js
   (downloadCanvasAsPng) wires the click target to the canvas. */
.chart-dl-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: auto;
  min-width: 26px;
  height: 26px;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-elev);
  color: var(--fg-muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.55;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
  z-index: 2;
}
.chart-dl-btn:hover,
.chart-dl-btn:focus-visible {
  opacity: 1;
  color: var(--fg-strong);
  border-color: var(--accent);
  background: var(--bg-elev-2);
}
.chart-dl-btn-icon {
  font-size: 0.85em;
  line-height: 1;
  transform: translateY(-1px);
}
.chart-dl-btn.is-saved {
  color: var(--good, #16a34a);
  border-color: var(--good, #16a34a);
  opacity: 1;
}
.chart-dl-btn.is-failed {
  color: var(--bad, #dc2626);
  border-color: var(--bad, #dc2626);
  opacity: 1;
}

/* ── Badges & tags ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--fg-muted);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}
.badge.tier-verified  {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 40%, transparent);
  background: color-mix(in srgb, var(--good) 10%, transparent);
}
.badge.tier-community {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: var(--accent-soft);
}
/* Compact KPI tile (with subtle vertical divider) */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  padding: 0 1.5rem;
  position: relative;
  min-width: 5.5rem;
}
.kpi + .kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 1px;
  background: var(--border-soft);
}
.kpi .kpi-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* Hero — centered text stack, no rounded clip. Background lives on
   body::before so the gradient bleeds into the page naturally. */
.hero {
  padding: 3.25rem 1rem 2.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.hero h1 {
  margin: 0 auto 0.55rem;
  font-size: 3rem;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 22ch;
}
.hero .hero-sub {
  margin: 0 auto 1.4rem;
  font-size: 1.15rem;
  color: var(--fg-strong);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.35;
  white-space: nowrap;
}
.hero .tagline {
  color: var(--fg-muted);
  margin: 0 auto 1.9rem;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 54ch;
}

.hero-stats {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 auto 1.75rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  max-width: 56rem;
}
.hero-cta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Recent-activity ribbon between the KPI strip and the CTA row.  Uses
   the accent palette to read as a "live" indicator without competing
   with the primary CTA below.  The pulsing dot mirrors a status-LED
   convention so contributors immediately register that the page
   updates as new submissions land. */
.hero-recent-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 auto 1.4rem;
  padding: 0.5rem 0.95rem 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev));
  color: var(--fg);
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.hero-recent-ribbon:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev));
  text-decoration: none;
}
.hero-recent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
  animation: hero-recent-pulse 2s ease-out infinite;
}
@keyframes hero-recent-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  70%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-recent-dot { animation: none; }
}
.hero-recent-text { color: var(--fg); }
.hero-recent-text strong { color: var(--fg-strong); font-weight: 600; }
.hero-recent-window { color: var(--fg-muted); margin-left: 0.25rem; }
.hero-recent-cta {
  color: var(--accent);
  font-weight: 500;
  margin-left: 0.4rem;
  white-space: nowrap;
}

/* Subtle accent on the freshness KPI so the "this week" tile reads as
   the active counter without overpowering the static stats next to it. */
.kpi.kpi--fresh .kpi-value { color: var(--accent); }
.kpi.kpi--fresh .kpi-label { color: var(--accent); opacity: 0.85; }

@media (max-width: 880px) {
  .hero .hero-sub { font-size: 1rem; }
}
@media (max-width: 720px) {
  .hero .hero-sub { font-size: 0.92rem; white-space: normal; max-width: 36ch; }
}
@media (max-width: 640px) {
  .hero { padding: 1.75rem 0.5rem 2rem; }
  .hero h1 { font-size: 1.85rem; }
  .hero .tagline { font-size: 0.92rem; }
  .hero-stats { padding: 0.9rem 0; }
  .kpi { padding: 0 0.85rem; min-width: 4rem; }
  .kpi .kpi-value { font-size: 1.4rem; }
  .kpi .kpi-label { font-size: 0.65rem; letter-spacing: 0.08em; }
  .hero-recent-ribbon { font-size: 0.82rem; padding: 0.4rem 0.75rem; max-width: 100%; }
  .hero-recent-window { display: block; margin-left: 0; }
  .hero-recent-cta { display: none; }
}
/* Very narrow viewports (≤420 — older phones, app drawer split-screen):
   long titles like "AccelMark Leaderboard" or "NVIDIA H100 80GB HBM3"
   overflow even at 1.85rem.  Drop another notch, force wrapping, and
   stack the CTA row so the buttons are full-bleed and tappable. */
@media (max-width: 420px) {
  .hero { padding: 1.4rem 0.4rem 1.6rem; }
  .hero h1 {
    font-size: 1.5rem;
    line-height: 1.1;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; text-align: center; }
}
