:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-warm: #f2f2f2;
  --ink: #000000;
  --ink-soft: #2a2a2a;
  --ink-mute: #707070;
  --accent: #000000;
  --rule: #e5e5e5;
  --rule-strong: #000000;
  --card: #ffffff;
  --title-font: Verdana, Geneva, sans-serif;
  --body-font: Arial, Helvetica, sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 12px 32px -20px rgba(0,0,0,0.18);
  --shadow-hover: 0 2px 4px rgba(0,0,0,0.06), 0 20px 40px -16px rgba(0,0,0,0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body-font);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--bg); }

/* ---------- HEADER ---------- */
header {
  border-bottom: 1px solid var(--ink);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.brand-mark::before {
  content: "■";
  color: var(--ink);
  margin-right: 8px;
  font-size: 14px;
  display: inline-block;
  transform: translateY(-1px);
}

.brand-sub {
  font-family: var(--body-font);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 400;
}

.header-meta {
  font-family: var(--body-font);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-meta span { color: var(--ink); font-weight: 700; }

/* ---------- HERO ---------- */
.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 100px 32px 60px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 60px;
  align-items: end;
}

.eyebrow {
  font-family: var(--body-font);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow::before {
  content: "";
  width: 36px;
  height: 2px;
  background: var(--ink);
}

h1 {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: clamp(44px, 6.5vw, 84px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--ink);
}

h1 em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
  border-bottom: 4px solid var(--ink);
  padding-bottom: 2px;
}

.lede {
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 420px;
  padding-bottom: 8px;
}

.lede strong {
  color: var(--ink);
  font-weight: 700;
}

/* ---------- SEARCH & FILTER BAR ---------- */
.controls {
  max-width: 1240px;
  margin: 40px auto 0;
  padding: 0 32px;
  position: sticky;
  top: 75px;
  z-index: 50;
}

.controls-inner {
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 18px 22px;
  display: flex;
  gap: 24px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.search-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0;
  color: var(--ink);
  font-size: 16px;
  pointer-events: none;
}

#search {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 0 8px 28px;
  font-family: var(--body-font);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}

#search:focus { border-bottom-color: var(--ink); }
#search::placeholder { color: var(--ink-mute); }

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 0;
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s ease;
}

.filter-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.count {
  font-family: var(--body-font);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.count strong { color: var(--ink); font-weight: 700; }

/* ---------- CATEGORIES ---------- */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}

.category {
  margin-bottom: 100px;
  scroll-margin-top: 160px;
}

.category-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: baseline;
  border-top: 2px solid var(--ink);
  padding-top: 22px;
  margin-bottom: 40px;
}

.category-num {
  font-family: var(--body-font);
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}

.category-title {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 40px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
}

.category-title em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
}

.category-desc {
  font-family: var(--body-font);
  font-size: 13px;
  color: var(--ink-mute);
  text-align: right;
  max-width: 280px;
  line-height: 1.5;
}

/* ---------- TOOL GRID ---------- */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.tool {
  background: var(--bg);
  padding: 28px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: background .25s ease, color .25s ease;
}

.tool:hover {
  background: var(--ink);
  color: var(--bg);
}

.tool.featured {
  background: var(--bg-soft);
  border-top: 4px solid var(--ink);
  padding-top: 24px;
}

.tool.featured:hover { background: var(--ink); color: var(--bg); }

.tool-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.tool-rank {
  font-family: var(--body-font);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
  padding-top: 4px;
  transition: color .25s ease;
}

.tool-rank.top {
  color: var(--ink);
}

.tool:hover .tool-rank,
.tool:hover .tool-rank.top {
  color: var(--bg);
}

.tool-name {
  font-family: var(--title-font);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  flex: 1;
}

.tool-name a {
  color: var(--ink);
  text-decoration: none;
  transition: color .25s ease;
}

.tool:hover .tool-name a { color: var(--bg); }

.tool-name a::after {
  content: " ↗";
  font-family: var(--body-font);
  font-size: 14px;
  font-weight: 400;
  opacity: 0.5;
}

.star {
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 2px;
  line-height: 1;
  padding-top: 6px;
  font-weight: 700;
  transition: color .25s ease;
}

.tool:hover .star { color: var(--bg); }

.tool-desc {
  font-family: var(--body-font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  flex: 1;
  transition: color .25s ease;
}

.tool:hover .tool-desc { color: var(--bg); }

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.tag {
  font-family: var(--body-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 4px 8px;
  border-radius: 0;
  text-transform: uppercase;
  transition: all .25s ease;
}

.tool:hover .tag {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--bg);
}

.tool-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--body-font);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  transition: border-color .25s ease, color .25s ease;
}

.tool:hover .tool-meta {
  border-top-color: var(--bg);
  color: var(--bg);
}

.tool-cost {
  color: var(--ink-soft);
  transition: color .25s ease;
}

.tool-cost.paid { color: var(--ink); font-weight: 700; }
.tool-cost.free { color: var(--ink); font-weight: 700; }

.tool:hover .tool-cost,
.tool:hover .tool-cost.paid,
.tool:hover .tool-cost.free { color: var(--bg); }

/* ---------- EMPTY STATE ---------- */
.empty {
  text-align: center;
  padding: 80px 20px;
  font-family: var(--title-font);
  font-weight: 700;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: -0.01em;
  display: none;
}

.empty.show { display: block; }

/* ---------- FOOTER ---------- */
footer {
  border-top: 2px solid var(--ink);
  background: var(--bg);
  padding: 48px 32px;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 20px;
  font-family: var(--body-font);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-inner strong { color: var(--ink); font-weight: 700; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 50px 24px 30px;
    gap: 28px;
  }
  .header-inner { padding: 14px 20px; }
  .header-meta { display: none; }
  .controls { padding: 0 20px; top: 65px; }
  .controls-inner { padding: 14px; gap: 14px; }
  main { padding: 40px 20px 80px; }
  .category-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .category-desc { text-align: left; max-width: 100%; }
  .tools { grid-template-columns: 1fr; }
  footer { padding: 30px 20px; }
}
