/**
 * Public performance card on the landing page (Phase 7 PR-C).
 * Reads /api/perf/public and renders a 4-metric grid.
 *
 * Brand palette is shared with the rest of the landing — cyan
 * (#07e0fd) into indigo (#54308c) — applied here as glow rings on
 * each metric card. Disclaimer is small but always present.
 */

.perf-public {
  position: relative;
  padding: 64px 24px 48px;
  text-align: center;
  background: transparent;
}

.perf-public .section-title {
  max-width: 880px;
  margin: 0 auto 36px;
}

.perf-public-sub {
  max-width: 640px;
  margin: 12px auto 0;
  color: rgba(255, 255, 255, 0.72);
}

/* ── 4-metric grid ─────────────────────────────────────── */

.perf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  max-width: var(--landing-container-max, 1200px);
  margin: 0 auto;
}

@media (max-width: 900px) {
  .perf-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .perf-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ── Metric card ───────────────────────────────────────── */

.perf-card {
  position: relative;
  padding: 24px 16px 22px;
  /* Grid items default to min-width:auto, which can prevent shrinking
     when content (like a 12-char PnL string) is wider than the slot.
     Setting it to 0 lets the cell shrink to its actual share. */
  min-width: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 17, 33, 0.72) 0%,
    rgba(8, 11, 24, 0.92) 100%
  );
  border: 1px solid rgba(7, 224, 253, 0.18);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.perf-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(7, 224, 253, 0.18) 0%,
    transparent 40%,
    rgba(84, 48, 140, 0.18) 100%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
}

.perf-card:hover {
  transform: translateY(-2px);
  border-color: rgba(7, 224, 253, 0.4);
  box-shadow: 0 12px 36px -18px rgba(7, 224, 253, 0.45);
}

.perf-card:hover::before {
  opacity: 1;
}

.perf-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
}

.perf-card-value {
  /* Sized to fit "+$18,578.05" (12 chars) inside a 4-column slot at the
     1200px container width without ever clipping. clamp() lets it grow
     on a single-column mobile layout but stays bounded on desktop. */
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  background: linear-gradient(
    135deg,
    #07e0fd 0%,
    #5b9cff 55%,
    #b58cff 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

/* Loading shimmer for the placeholder em-dash before data arrives */
.perf-grid[data-state="loading"] .perf-card-value {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.18) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: perf-shimmer 1.6s ease-in-out infinite;
}

@keyframes perf-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.perf-card-foot {
  margin-top: 10px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Sign tinting — green for profit, red for loss. Applied by JS via data-sign. */
.perf-card[data-sign="positive"] .perf-card-value {
  background: linear-gradient(135deg, #4ade80 0%, #07e0fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.perf-card[data-sign="negative"] .perf-card-value {
  background: linear-gradient(135deg, #f87171 0%, #fca5a5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Disclaimer (always present, never hidden) ────────── */

.perf-disclaimer {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 12px 20px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.55;
}

/* ── Empty / unavailable state ────────────────────────── */

.perf-grid[data-state="unavailable"] .perf-card-value {
  color: rgba(255, 255, 255, 0.45);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.45);
  background: none;
  font-size: 1.6rem;
}

.perf-grid[data-state="unavailable"] .perf-card-foot {
  color: rgba(255, 255, 255, 0.35);
}
