/* —— Tokens —— */
:root {
  --bg: #f7f6f3;
  --bg-elevated: #ffffff;
  --bg-muted: #f0eeea;
  --border: #e6e3dc;
  --border-strong: #d4d0c7;
  --text: #1c1b19;
  --text-secondary: #5c5954;
  --text-muted: #8a867e;
  --shadow: 0 1px 2px rgba(28, 27, 25, 0.04),
    0 4px 16px rgba(28, 27, 25, 0.04);
  --shadow-hover: 0 2px 4px rgba(28, 27, 25, 0.05),
    0 12px 28px rgba(28, 27, 25, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --web: #2f6fed;
  --web-bg: #eef3ff;
  --web-border: #d4e0ff;
  --mobile: #0d9f6e;
  --mobile-bg: #e8f8f1;
  --mobile-border: #c5ebd9;
  --ai: #8b5cf6;
  --ai-bg: #f3efff;
  --ai-border: #e0d6ff;

  --focus: #2f6fed;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, #fff 0%, transparent 70%),
    radial-gradient(circle at 100% 0%, rgba(47, 111, 237, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 40%);
}

/* —— Layout —— */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* —— Header —— */
.header {
  margin-bottom: 2rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.brand-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2f6fed 0%, #8b5cf6 55%, #0d9f6e 100%);
  box-shadow: 0 4px 12px rgba(47, 111, 237, 0.2);
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.65rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.tagline {
  margin: 0;
  max-width: 36rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-stats strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-divider {
  width: 1px;
  height: 14px;
  background: var(--border-strong);
}

/* —— Toolbar —— */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.25rem;
  position: sticky;
  top: 0.75rem;
  z-index: 10;
  padding: 0.65rem;
  background: rgba(247, 246, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.6rem;
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search::placeholder {
  color: var(--text-muted);
}

.search:hover {
  border-color: var(--border-strong);
}

.search:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: #fafaf8;
}

.filter-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.2);
}

.filter-btn.active {
  color: var(--text);
  background: var(--bg-muted);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 2px rgba(28, 27, 25, 0.04);
}

.filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.filter-dot.web {
  background: var(--web);
}

.filter-dot.mobile {
  background: var(--mobile);
}

.filter-dot.ai {
  background: var(--ai);
}

/* —— Category summary chips —— */
.category-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  min-height: 1.75rem;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.summary-chip.web {
  color: #1e4fc4;
  background: var(--web-bg);
  border-color: var(--web-border);
}

.summary-chip.mobile {
  color: #0a7a55;
  background: var(--mobile-bg);
  border-color: var(--mobile-border);
}

.summary-chip.ai {
  color: #6d3fd4;
  background: var(--ai-bg);
  border-color: var(--ai-border);
}

.summary-chip strong {
  font-variant-numeric: tabular-nums;
}

/* —— Grid —— */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}

/* —— Card —— */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem 1.2rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-strong);
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.tag.web {
  color: #1e4fc4;
  background: var(--web-bg);
  border-color: var(--web-border);
}

.tag.mobile {
  color: #0a7a55;
  background: var(--mobile-bg);
  border-color: var(--mobile-border);
}

.tag.ai {
  color: #6d3fd4;
  background: var(--ai-bg);
  border-color: var(--ai-border);
}

.card-id {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.card h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  flex: 1;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.15rem;
}

.severity {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.severity::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.severity.high {
  color: #c2410c;
}

.severity.medium {
  color: #a16207;
}

.severity.low {
  color: #64748b;
}

.area {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  background: var(--bg-muted);
  border-radius: 6px;
}

/* —— Empty —— */
.empty {
  margin: 3rem auto;
  max-width: 22rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* —— Footer —— */
.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-note {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-credit {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-credit a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.footer-credit a:hover {
  color: var(--web);
  border-bottom-color: rgba(47, 111, 237, 0.35);
}

.footer-credit a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .card,
  .filter-btn,
  .search {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

/* —— Responsive —— */
@media (max-width: 640px) {
  .page {
    padding: 1.5rem 1rem 3rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    top: 0.5rem;
  }

  .filters {
    justify-content: flex-start;
  }

  .filter-btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
