:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171019;
  background: #faf5fa;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 30px 0 80px;
  background:
    linear-gradient(rgba(143, 56, 189, 0.05) 1px, transparent 1px),
    radial-gradient(circle, rgba(47, 13, 55, 0.22) 1.5px, transparent 1.7px),
    #faf5fa;
  background-size: 100% 25px, 32px 32px, auto;
}

button, input { font: inherit; }

.tools-shell {
  width: min(1680px, calc(100vw - 32px));
  margin: 72px auto 0;
  border: 2px solid rgba(47, 13, 55, 0.42);
  background: rgba(255, 250, 253, 0.96);
  box-shadow: 8px 8px 0 rgba(47, 13, 55, 0.1);
}

.tools-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: end;
  gap: 48px;
  padding: 48px 52px 42px;
  border-bottom: 2px solid rgba(47, 13, 55, 0.32);
}

.eyebrow {
  margin: 0 0 10px;
  color: #7b229e;
  font: 900 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(48px, 6.4vw, 104px);
  line-height: 0.9;
  letter-spacing: 0;
}

.tools-intro {
  max-width: 610px;
  margin: 0 0 4px;
  color: #5d4a62;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

.directory { padding: 34px 32px 38px; }

.directory-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 62px;
  border: 2px solid #171019;
  background: #fff;
  box-shadow: 6px 6px 0 rgba(123, 34, 158, 0.14);
}

.search-control {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}

.search-icon {
  width: 17px;
  height: 17px;
  border: 2px solid #765f7b;
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: #765f7b;
  transform: rotate(45deg);
}

.search-control input {
  min-width: 0;
  height: 56px;
  border: 0;
  outline: 0;
  color: #171019;
  background: transparent;
  font-size: 16px;
  font-weight: 750;
}

.search-control input::placeholder { color: #9a8a9d; }

.result-count {
  align-self: center;
  margin-right: 12px;
  padding: 8px 11px;
  border: 1px solid rgba(47, 13, 55, 0.28);
  background: #f4e8f7;
  color: #624b67;
  font: 900 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.tool-filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 22px 0;
  scrollbar-width: thin;
}

.filter-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(47, 13, 55, 0.34);
  background: #fffafd;
  color: #705975;
  cursor: pointer;
  font: 900 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.filter-button:hover,
.filter-button.active {
  border-color: #7b229e;
  background: #7b229e;
  color: #fff;
}

.directory-table { border: 1px solid rgba(47, 13, 55, 0.32); background: #fff; }

.directory-head,
.tool-row {
  display: grid;
  grid-template-columns: minmax(185px, 1.25fr) minmax(110px, 0.7fr) minmax(300px, 2fr) minmax(90px, 0.55fr) minmax(120px, 0.7fr) 98px;
  align-items: center;
  column-gap: 20px;
}

.directory-head {
  min-height: 48px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(47, 13, 55, 0.2);
  background: #f4edf5;
  color: #806e84;
  font: 900 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.tool-row {
  min-height: 112px;
  padding: 20px;
  border-bottom: 1px solid rgba(47, 13, 55, 0.16);
}

.tool-row:last-child { border-bottom: 0; }
.tool-row:hover { background: #fff9ff; }

.tool-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }

.tool-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  color: var(--mark-color, #7b229e);
  background: transparent;
  font: 950 14px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
}

.tool-mark img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.tool-mark-fallback { display: none; grid-area: 1 / 1; }
.tool-mark.fallback img { display: none; }
.tool-mark.fallback .tool-mark-fallback { display: block; }

.tool-identity strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.tool-identity small { display: block; margin-top: 4px; color: #8a758e; font-size: 11px; font-weight: 750; }
.tool-category, .tool-chains, .tool-access { color: #655268; font-size: 13px; font-weight: 750; }
.tool-description { margin: 0; color: #4e4051; font-size: 14px; line-height: 1.48; }

.tool-access span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(47, 13, 55, 0.3);
  color: #7b229e;
  background: #f7eef9;
  font: 900 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 2px solid #171019;
  color: #171019;
  background: #b45ad6;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.visit-link:hover { background: #171019; color: #fff; }

.tool-empty { padding: 56px 20px; text-align: center; }
.tool-empty strong, .tool-empty span { display: block; }
.tool-empty span { margin-top: 8px; color: #705d74; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .tools-heading { grid-template-columns: 1fr; gap: 20px; padding: 38px 28px 32px; }
  .directory-head { display: none; }
  .tool-row { grid-template-columns: minmax(190px, 1fr) minmax(240px, 1.5fr) 96px; min-height: 126px; }
  .tool-category, .tool-access, .tool-chains { grid-row: 2; }
  .tool-description { grid-column: 2; grid-row: 1; }
  .visit-link { grid-column: 3; grid-row: 1; }
}

@media (max-width: 680px) {
  body { padding-top: 16px; }
  .tools-shell { width: calc(100vw - 16px); margin-top: 60px; }
  .tools-heading { padding: 30px 20px; }
  h1 { font-size: 48px; }
  .tools-intro { min-width: 0; font-size: 15px; }
  .directory { padding: 22px 14px 28px; }
  .directory-controls { grid-template-columns: 1fr; }
  .result-count { display: none; }
  .tool-row { grid-template-columns: 1fr auto; gap: 12px; min-height: 0; padding: 18px 16px; }
  .tool-identity { grid-column: 1; }
  .visit-link { grid-column: 2; grid-row: 1; width: 76px; }
  .tool-description { grid-column: 1 / -1; grid-row: 2; }
  .tool-category, .tool-access, .tool-chains { grid-row: auto; }
  .tool-category { grid-column: 1; }
  .tool-access { grid-column: 2; justify-self: end; }
  .tool-chains { grid-column: 1 / -1; }
}
