/**
 * Community Signal — public discover page.
 *
 * DESIGN ANCHORS (per /plan-design-review):
 *   - Card composition is the moat: watch count + ECS at same visual level.
 *     Don't let the ECS badge shrink to a corner — that breaks the narrative.
 *   - Emerald (--cs-accent) for ALL interactive accents. Never amber.
 *     Amber is reserved for governance/risk signals (Kavach flags) elsewhere.
 *   - Tab strip uses slide-underline, not pills/segments. Premium-financial idiom.
 *   - Mobile (<768px) flips cards to landscape-compact (5 per screen-height)
 *     instead of stacked-portrait (1-2 per screen-height). Faster scan.
 *   - Empty state has warmth: title + body + CTA. Never "no data found".
 *
 * Tokens local to this page (kept inline so future migration doesn't depend
 * on common.css token names — paywall memory's --accent/--bg-elevated/--border
 * may not exist project-wide yet).
 */

:root {
  --cs-accent: #34d399;        /* paywall memory --accent (dark mode) */
  --cs-accent-border: rgba(52, 211, 153, 0.4);
  --cs-accent-tint: rgba(52, 211, 153, 0.08);
  --cs-bg: #0f0f1a;            /* ui-design.md dark bg (not pure black) */
  --cs-bg-elevated: #16162a;   /* card surface, 2-3 steps lighter */
  --cs-border: rgba(255, 255, 255, 0.06);   /* hairline */
  --cs-border-hover: rgba(255, 255, 255, 0.12);
  --cs-text-primary: #e0e0e6;  /* never pure white */
  --cs-text-secondary: #8a8a9a;
  --cs-text-muted: #5a5a6a;
}

/* ──────────────────────────── Hidden attribute hard-stop ──────────────────────────── */

/* `display: grid` on .cs-grid (and similar) overrides the user-agent default
   `display: none` when [hidden] is set on the element. Force the attribute to
   win — it's how we toggle skeleton vs. empty-state. Without this, both render. */
[hidden] {
  display: none !important;
}

/* ──────────────────────────── Page shell ──────────────────────────── */

body {
  background: var(--cs-bg);
  color: var(--cs-text-primary);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums;     /* per ui-design.md commandment 2 */
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

.cs-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ──────────────────────────── Masthead ──────────────────────────── */

.cs-masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--cs-border);
}

.cs-logo {
  display: inline-flex;
  align-items: center;
}

.cs-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.cs-nav-link {
  color: var(--cs-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 150ms ease;
}

.cs-nav-link:hover {
  color: var(--cs-text-primary);
}

.cs-nav-cta {
  color: var(--cs-accent);
  border: 1px solid var(--cs-accent-border);
  padding: 8px 16px;
  border-radius: 6px;
}

.cs-nav-cta:hover {
  background: var(--cs-accent-tint);
  color: var(--cs-accent);
}

/* ──────────────────────────── Hero ──────────────────────────── */

.cs-hero {
  padding: 80px 0 48px;
  max-width: 880px;
}

.cs-hero-title {
  font-family: "Syne", "Inter", sans-serif;
  font-weight: 700;
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  color: var(--cs-text-primary);
}

.cs-hero-eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;     /* per ui-design.md uppercase rule */
  text-transform: uppercase;
  color: var(--cs-text-secondary);
  margin: 0;
  min-height: 1em;
}

.cs-eyebrow-loading {
  color: var(--cs-text-muted);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* ──────────────────────────── Tab strip (slide-underline) ──────────────────────────── */

.cs-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--cs-border);
  margin-bottom: 32px;
}

.cs-tab {
  background: transparent;
  border: none;
  padding: 16px 0;
  color: var(--cs-text-secondary);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-tab:hover:not(.cs-tab-disabled) {
  color: var(--cs-text-primary);
}

.cs-tab-active {
  color: var(--cs-text-primary);
}

.cs-tab-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--cs-accent);
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-tab-disabled {
  color: var(--cs-text-muted);
  cursor: not-allowed;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cs-tab-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-text-muted);
  padding: 2px 6px;
  border: 1px solid var(--cs-border);
  border-radius: 4px;
}

.cs-tab:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 4px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .cs-tab,
  .cs-tab-active::after {
    transition: none;
  }
}

/* ──────────────────────────── Card grid ──────────────────────────── */

.cs-grid-wrap {
  min-height: 400px;
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

@media (max-width: 1199px) {
  .cs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .cs-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ──────────────────────────── Card ──────────────────────────── */

.cs-card {
  background: var(--cs-bg-elevated);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 6px;
  transition: border-color 150ms ease, transform 150ms ease;
}

.cs-card:hover {
  border-color: var(--cs-border-hover);
  transform: translateY(-1px);
}

.cs-card:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
}

.cs-card-rank {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--cs-text-muted);
  letter-spacing: 0.04em;
}

.cs-card-symbol {
  font-family: "Inter", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--cs-text-primary);
}

.cs-card-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--cs-text-secondary);
  letter-spacing: -0.01em;
  line-height: 1.3;
  /* Allow wrap up to 2 lines, truncate beyond */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.cs-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 4px;
}

.cs-card-count {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-card-count-num {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--cs-text-primary);
  font-variant-numeric: tabular-nums;
}

.cs-card-count-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cs-text-secondary);
}

.cs-card-ecs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--cs-accent-border);
  border-radius: 4px;
  background: transparent;
  color: var(--cs-accent);
}

.cs-card-ecs-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cs-card-ecs-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.cs-card-ecs-empty {
  width: 1px;     /* preserves row alignment when ECS missing */
  height: 1px;
}

.cs-card-meta {
  font-size: 12px;
  color: var(--cs-text-muted);
  letter-spacing: -0.01em;
}

/* ──────────────────────────── Mobile landscape card ──────────────────────────── */

@media (max-width: 767px) {
  .cs-card {
    grid-template-columns: 32px 1fr auto auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "rank symbol count ecs"
      "rank name   meta  meta";
    gap: 4px 12px;
    padding: 12px 14px;
    align-items: center;
  }

  .cs-card-rank {
    grid-area: rank;
    font-size: 13px;
    align-self: center;
  }

  .cs-card-symbol {
    grid-area: symbol;
    font-size: 16px;
  }

  .cs-card-name {
    grid-area: name;
    font-size: 12px;
    -webkit-line-clamp: 1;
    min-height: auto;
  }

  .cs-card-row {
    /* In mobile, count + ecs lay out as separate grid cells, not as a row */
    display: contents;
  }

  .cs-card-count {
    grid-area: count;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
  }

  .cs-card-count-num {
    font-size: 16px;
  }

  .cs-card-count-label {
    font-size: 10px;
  }

  .cs-card-ecs {
    grid-area: ecs;
    padding: 3px 8px;
  }

  .cs-card-ecs-value {
    font-size: 13px;
  }

  .cs-card-meta {
    grid-area: meta;
    font-size: 11px;
  }
}

/* ──────────────────────────── Skeleton (high-fidelity, matches layout) ──────────────────────────── */

.cs-card-skeleton {
  cursor: default;
  pointer-events: none;
}

.cs-skel-rank,
.cs-skel-symbol,
.cs-skel-name,
.cs-skel-count,
.cs-skel-ecs,
.cs-skel-meta {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: cs-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

.cs-skel-rank {
  width: 24px;
  height: 11px;
}

.cs-skel-symbol {
  width: 80px;
  height: 22px;
}

.cs-skel-name {
  width: 100%;
  height: 13px;
  margin-bottom: 4px;
}

.cs-skel-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 4px;
}

.cs-skel-count {
  width: 60px;
  height: 22px;
}

.cs-skel-ecs {
  width: 56px;
  height: 26px;
}

.cs-skel-meta {
  width: 70%;
  height: 12px;
}

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

@media (prefers-reduced-motion: reduce) {
  .cs-skel-rank,
  .cs-skel-symbol,
  .cs-skel-name,
  .cs-skel-count,
  .cs-skel-ecs,
  .cs-skel-meta {
    animation: none;
  }
}

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

.cs-empty {
  text-align: center;
  padding: 80px 24px;
  max-width: 520px;
  margin: 0 auto;
}

.cs-empty-title {
  font-family: "Syne", "Inter", sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--cs-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.cs-empty-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--cs-text-secondary);
  margin: 0 0 32px;
}

.cs-empty-cta {
  display: inline-block;
  background: var(--cs-accent);
  color: #062b1f;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: filter 150ms ease;
}

.cs-empty-cta:hover {
  filter: brightness(1.08);
}

/* ──────────────────────────── Footer CTA ──────────────────────────── */

.cs-footer-cta {
  text-align: center;
  padding: 80px 24px 40px;
  margin-top: 80px;
  border-top: 1px solid var(--cs-border);
}

.cs-footer-title {
  font-family: "Syne", "Inter", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cs-footer-button {
  display: inline-block;
  background: var(--cs-accent);
  color: #062b1f;
  padding: 14px 32px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: filter 150ms ease;
}

.cs-footer-button:hover {
  filter: brightness(1.08);
}

.cs-footer-button:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 4px;
}

.cs-footer-trust {
  font-size: 12px;
  color: var(--cs-text-muted);
  letter-spacing: 0.02em;
  margin: 16px 0 0;
}

/* ──────────────────────────── Disclaimer ──────────────────────────── */

.cs-disclaimer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--cs-border);
  margin-top: 40px;
}

.cs-disclaimer p {
  font-size: 11px;
  color: var(--cs-text-muted);
  letter-spacing: 0.02em;
  line-height: 1.5;
  margin: 0;
}

/* ──────────────────────────── FOMO upsell modal (PR8) ──────────────────────────── */

/* Anchored design review choices (do not soften without compliance):
   - Brand emerald CTA per memory/feedback_paywall_color_palette.md — never amber
   - Neutral surface + hairline border — paywall is quiet, content is the hero
   - "Maybe later" real dismiss — never a guilt-trip "no thanks" copy
   - Trust signal explicit ("Free. No card.") — preempts credit-card anxiety
   - No emoji, no "PRO" badges, no shimmer — premium-financial, not Groupon
*/

.cs-fomo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: cs-fomo-fade 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-fomo-card {
  position: relative;
  background: var(--cs-bg-elevated);
  border: 1px solid var(--cs-border);
  border-radius: 12px;
  padding: 40px 36px 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  animation: cs-fomo-slide-in 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-fomo-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--cs-text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  transition: color 150ms ease;
}

.cs-fomo-close:hover {
  color: var(--cs-text-primary);
}

.cs-fomo-close:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
}

.cs-fomo-context {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-text-secondary);
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.cs-fomo-title {
  font-family: "Syne", "Inter", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--cs-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 14px;
}

.cs-fomo-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--cs-text-secondary);
  margin: 0 0 28px;
}

.cs-fomo-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.cs-fomo-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  background: var(--cs-accent);
  color: #062b1f;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  border-radius: 6px;
  transition: filter 150ms ease;
  white-space: nowrap;
}

.cs-fomo-primary:hover {
  filter: brightness(1.08);
}

.cs-fomo-primary:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 3px;
}

.cs-fomo-secondary {
  background: transparent;
  border: none;
  color: var(--cs-text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 12px 10px;
  letter-spacing: -0.01em;
  transition: color 150ms ease;
}

.cs-fomo-secondary:hover {
  color: var(--cs-text-primary);
}

.cs-fomo-secondary:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.cs-fomo-trust {
  font-size: 11px;
  color: var(--cs-text-muted);
  text-align: center;
  margin: 0;
  letter-spacing: 0.02em;
}

@keyframes cs-fomo-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cs-fomo-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cs-fomo-overlay,
  .cs-fomo-card {
    animation: none;
  }
}

/* Mobile — full-width sheet feel, but still bounded */
@media (max-width: 480px) {
  .cs-fomo-overlay {
    padding: 16px;
  }
  .cs-fomo-card {
    padding: 32px 24px 22px;
  }
  .cs-fomo-title {
    font-size: 22px;
  }
  .cs-fomo-actions {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .cs-fomo-primary {
    flex: 0 0 auto;
  }
}

/* ──────────────────────────── Mobile typography adjustments ──────────────────────────── */

@media (max-width: 767px) {
  .cs-page {
    padding: 0 16px 60px;
  }

  .cs-hero {
    padding: 48px 0 32px;
  }

  .cs-hero-title {
    font-size: 32px;
    line-height: 1.15;
  }

  .cs-tabs {
    gap: 24px;
    margin-bottom: 24px;
  }

  .cs-empty-title,
  .cs-footer-title {
    font-size: 22px;
  }

  .cs-footer-cta {
    padding: 60px 16px 32px;
    margin-top: 60px;
  }
}
