:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #111827;
  --text-secondary: #64748B;
  --brand: #635BFF;
  --accent: #0EA5E9;
  --success: #16A34A;
  --warning: #D97706;
  --border: #E5E7EB;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

a { color: var(--brand); }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px 48px; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--brand); }
.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
}
.main-nav a:hover { color: var(--brand); }

h1 { font-size: 1.9rem; line-height: 1.25; margin: 28px 0 8px; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 0 0 8px; }
.lede { color: var(--text-secondary); font-size: 1.05rem; margin: 0 0 24px; }

.search-box { margin: 0 0 16px; }
.search-box label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-box input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.filter-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.filter-group legend { font-weight: 700; padding: 0 4px; }
.filter-group label { display: block; margin: 6px 0; cursor: pointer; }
.filter-group input { margin-right: 8px; accent-color: var(--brand); }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.results-bar p { margin: 0; color: var(--text-secondary); }
.button {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.button:hover { background: #5148e6; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06);
  transition: box-shadow 150ms ease, transform 150ms ease;
}
.tool-card:hover {
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.10);
  transform: translateY(-2px);
}
.tool-card h2 { margin-bottom: 4px; }
.tool-card h2 a { color: var(--text); text-decoration: none; }
.tool-card h2 a:hover { color: var(--brand); }
.tool-card p { margin: 8px 0; }
.meta { color: var(--text-secondary); font-size: 0.92rem; }

.badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  margin-right: 6px;
}
.badge-free { background: #DCFCE7; color: #166534; }
.badge-forever { background: #E0F2FE; color: #075985; }
.badge-freemium { background: #FEF3C7; color: #92400E; }
.badge-notes { background: #EDE9FE; color: #4C1D95; }
.badge-writing { background: #FCE7F3; color: #9D174D; }
.badge-design { background: #FFEDD5; color: #9A3412; }

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
}
.empty-state p { color: var(--text-secondary); }

.limit-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
}
.limit-box h2 { margin-bottom: 6px; }

.tool-page section { margin: 24px 0; }
.tool-page ul { padding-left: 22px; }
.tool-page li { margin: 4px 0; }

.back-link { display: inline-block; margin: 20px 0 0; font-weight: 600; }
.other-tools { margin-top: 32px; }
.other-tools ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.other-tools a {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  color: var(--text);
  text-decoration: none;
}
.other-tools a:hover { border-color: var(--brand); color: var(--brand); }

.note {
  color: var(--text-secondary);
  font-size: 0.92rem;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  padding-top: 16px;
}
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 20px 0 0;
  margin-top: 40px;
}

@media (max-width: 640px) {
  h1 { font-size: 1.55rem; }
  .results-bar { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card, .button { transition: none; }
  .tool-card:hover { transform: none; }
}
