/* ========================================
   LeakFinder — Poker Card Mini-Cards
   Visual card rendering for leak examples
   ======================================== */

/* ── Card base ── */
.lf-card {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-radius: 6px;
  font-family: "JetBrains Mono", "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  border: 1px solid;
  vertical-align: middle;
  white-space: nowrap;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.lf-card:hover {
  transform: translateY(-1px);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.45),
    0 0 0 0.5px rgba(255, 255, 255, 0.08) inset;
}

.lf-card__rank {
  font-size: 12px;
}

.lf-card__suit {
  font-size: 11px;
  line-height: 1;
}

/* ── Suit color variants (WCAG AA · color-blind safe) ──
   Solid opaque backgrounds so cards pop on dark felt.
   Palette: silver spades, coral hearts, blue diamonds, gold clubs.
   Avoids red-green confusion (protanopia/deuteranopia). */

/* Spades ♠ — black */
.lf-suit--spade {
  color: #e8ecf4;
  background: linear-gradient(160deg, #3a4558, #1e2738);
  border-color: rgba(100, 120, 150, 0.4);
}

.lf-suit--spade .lf-card__suit {
  color: #8896ab;
}

/* Hearts ♥ — red */
.lf-suit--heart {
  color: #fff;
  background: linear-gradient(160deg, #ef4444, #b91c1c);
  border-color: rgba(239, 68, 68, 0.45);
}

.lf-suit--heart .lf-card__suit {
  color: #fecaca;
}

/* Diamonds ♦ — turquoise blue */
.lf-suit--diamond {
  color: #fff;
  background: linear-gradient(160deg, #22d3ee, #0891b2);
  border-color: rgba(34, 211, 238, 0.5);
}

.lf-suit--diamond .lf-card__suit {
  color: #cffafe;
}

/* Clubs ♣ — green */
.lf-suit--club {
  color: #fff;
  background: linear-gradient(160deg, #22c55e, #15803d);
  border-color: rgba(34, 197, 94, 0.45);
}

.lf-suit--club .lf-card__suit {
  color: #bbf7d0;
}

/* ── Focus state for keyboard navigation ── */
.lf-card:focus-visible {
  outline: 2px solid var(--brm8-primary, #8aebff);
  outline-offset: 2px;
}

/* ── Hand pair (two cards side by side) ── */
.lf-hand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Second card slight overlap effect ── */
.lf-hand .lf-card:last-child {
  margin-left: -2px;
}

/* ── Source range link ── */
.lf-source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--brm8-primary);
  background: color-mix(in srgb, var(--brm8-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--brm8-primary) 18%, transparent);
  transition: all 0.15s ease-out;
  white-space: nowrap;
}

.lf-source-link:hover {
  background: color-mix(in srgb, var(--brm8-primary) 14%, transparent);
  border-color: color-mix(in srgb, var(--brm8-primary) 32%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--brm8-primary) 12%, transparent);
}

.lf-source-link:focus-visible {
  outline: 2px solid var(--brm8-primary, #8aebff);
  outline-offset: 2px;
}

.lf-source-link .material-symbols-outlined {
  font-size: 13px;
}

/* ── Expandable examples (details/summary) ── */
.lf-details summary {
  list-style: none;
}

.lf-details summary::-webkit-details-marker {
  display: none;
}

.lf-details__summary:hover {
  opacity: 0.8;
}

.lf-details__summary:focus-visible {
  outline: 2px solid var(--brm8-primary, #8aebff);
  outline-offset: 2px;
  border-radius: 4px;
}

.lf-details__chevron {
  transition: transform 0.2s ease-out;
}

.lf-details[open] .lf-details__chevron {
  transform: rotate(180deg);
}

/* Toggle labels: show/hide based on open state */
.lf-details__label-open {
  display: none;
}

.lf-details[open] .lf-details__label-closed {
  display: none;
}

.lf-details[open] .lf-details__label-open {
  display: inline;
}

/* ── File input: selected state ── */
.lf-file-selected .rp-field {
  border-color: var(--brm8-primary);
}

.lf-file-selected [data-icon] {
  color: var(--brm8-primary);
  opacity: 1;
}

.lf-file-selected [data-filename] {
  color: var(--brm8-text-main);
  font-weight: 600;
}

/* ── Donut chart ── */
.lf-donut-segment {
  transition: opacity 0.15s ease-out, filter 0.15s ease-out;
}

.lf-donut-segment:hover {
  opacity: 0.85;
  filter: brightness(1.15);
}

.lf-legend-row {
  text-decoration: none;
}

.lf-legend-row:hover {
  background: color-mix(in srgb, var(--rb-surface, #1e293b) 80%, var(--brm8-primary, #8aebff));
}

/* ── Light mode overrides ── */
html:not(.dark) .lf-card {
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(0, 0, 0, 0.04) inset;
}

html:not(.dark) .lf-card:hover {
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.16),
    0 0 0 0.5px rgba(0, 0, 0, 0.06) inset;
}

html:not(.dark) .lf-suit--spade {
  color: #1e293b;
  background: linear-gradient(160deg, #475569, #1e293b);
  border-color: rgba(30, 41, 59, 0.25);
}

html:not(.dark) .lf-suit--spade .lf-card__suit {
  color: #94a3b8;
}

html:not(.dark) .lf-suit--heart {
  color: #fff;
  background: linear-gradient(160deg, #dc2626, #991b1b);
  border-color: rgba(220, 38, 38, 0.3);
}

html:not(.dark) .lf-suit--heart .lf-card__suit {
  color: #fecaca;
}

html:not(.dark) .lf-suit--diamond {
  color: #fff;
  background: linear-gradient(160deg, #06b6d4, #0e7490);
  border-color: rgba(6, 182, 212, 0.3);
}

html:not(.dark) .lf-suit--diamond .lf-card__suit {
  color: #cffafe;
}

html:not(.dark) .lf-suit--club {
  color: #fff;
  background: linear-gradient(160deg, #16a34a, #166534);
  border-color: rgba(22, 163, 74, 0.3);
}

html:not(.dark) .lf-suit--club .lf-card__suit {
  color: #bbf7d0;
}
