/* ──────────────────────────────────────────────────────────────
   Commune Solutions — marketplace
   Réutilise les tokens du landing pour cohérence visuelle.
   ────────────────────────────────────────────────────────────── */

:root {
  --primary: #1976D2;
  --primary-light: #e3f2fd;
  --primary-dark: #1565c0;
  --accent: #ff6b35;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.1), 0 8px 16px rgba(15, 23, 42, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--surface-soft);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.topbar-title { font-size: 15px; }
.topbar-link {
  font-size: 14px;
  color: var(--text-muted);
}

/* Hero ───────────────────────────────────────────────── */
.hero {
  padding: 56px 32px 32px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 980px; margin: 0 auto; }
.hero h1 {
  font-size: 40px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.hero-title {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-beta {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  vertical-align: middle;
  line-height: 1;
}
.hero-lead {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 0 20px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-soft);
}
.hero-meta-text { color: var(--text-soft); }

/* Catalog ────────────────────────────────────────────── */
.catalog { padding: 32px; }
.catalog-inner { max-width: 980px; margin: 0 auto; }

.filterbar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter:hover { border-color: var(--border-strong); }
.filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.loading {
  color: var(--text-soft);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.empty-state p { margin: 0 0 6px; color: var(--text); }
.empty-state-sub { color: var(--text-muted) !important; font-size: 14px; }

/* Module card ────────────────────────────────────────── */
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  text-decoration: none;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-head-text {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}
.card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-soft);
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 11px;
}

/* Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-official {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.badge-community {
  background: #fef3c7;
  color: #92400e;
}
.badge-info {
  background: var(--surface-alt);
  color: var(--text-muted);
  text-transform: none;
}

/* Module page ────────────────────────────────────────── */
.module-page { max-width: 860px; margin: 0 auto; padding: 40px 32px 80px; }
.module-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.module-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary-dark);
  flex-shrink: 0;
}
.module-head-text { flex: 1; }
.module-head-text h1 {
  margin: 0 0 6px;
  font-size: 32px;
  letter-spacing: -0.02em;
}
.module-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-soft);
}

.module-section {
  margin-bottom: 32px;
}
.module-section h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin: 0 0 12px;
}
.module-description {
  font-size: 16px;
  color: var(--text);
  line-height: 1.65;
}

/* Capabilities (style permissions Android) ───────────── */
.cap-list { list-style: none; margin: 0; padding: 0; }
.cap-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cap-item:last-child { border-bottom: 0; }
.cap-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 16px;
}
.cap-icon.read { background: var(--primary-light); color: var(--primary-dark); }
.cap-icon.write { background: #fef3c7; color: #92400e; }
.cap-text { flex: 1; }
.cap-target {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cap-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.cap-type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-alt);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Screens list ───────────────────────────────────────── */
.screens-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.screen-pill {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.screen-pill:hover {
  border-color: var(--primary);
  color: var(--text);
  background: var(--primary-light);
}

.module-preview-cta {
  flex-shrink: 0;
  padding: 10px 18px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s ease;
  align-self: flex-start;
}
.module-preview-cta:hover { opacity: 0.9; }

.module-section-hint {
  font-size: 13px;
  color: var(--text-soft);
  margin: 0 0 12px;
  line-height: 1.5;
}
.module-section-hint code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Tags + facts grid ──────────────────────────────────── */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.fact-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}
.fact-value {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text);
}

/* CTA + buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--text-muted); text-decoration: none; }

.dev-cta {
  padding: 56px 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.dev-cta-inner { max-width: 720px; margin: 0 auto; text-align: center; }
.dev-cta h2 { margin: 0 0 12px; font-size: 22px; }
.dev-cta p { color: var(--text-muted); margin: 0 0 24px; line-height: 1.6; }
.dev-cta-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer {
  padding: 24px 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--surface-soft);
}

@media (max-width: 600px) {
  .hero { padding: 32px 20px 24px; }
  .hero h1 { font-size: 30px; }
  .catalog, .topbar, .module-page, .dev-cta, .footer { padding-left: 20px; padding-right: 20px; }
  .module-head { flex-direction: column; gap: 12px; }
}
