.tools-page {
  --tools-width: 1280px;
  --tools-cell-padding: 27px;
  background: var(--canvas);
}

.tools-page .site-menu a[aria-current="page"] {
  color: var(--text);
}

.tools-page .site-menu a[aria-current="page"]::after {
  width: 100%;
}

.tools-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 96px), var(--tools-width));
  margin-inline: auto;
  padding: 82px 0 74px;
}

.tools-panel {
  padding: 42px 44px 30px;
  background: var(--canvas);
  color: #f7f7f7;
  box-shadow: none;
}

html[data-theme="light"] .tools-panel {
  background: #f8f8fa;
  color: #171719;
}

.tools-intro {
  max-width: 680px;
  margin: 0 0 38px;
}

.tools-eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tools-intro h1 {
  margin: 0;
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  font-size: clamp(42px, 4.5vw, 52px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}

.tools-intro > p:last-child {
  max-width: 600px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}

.tool-category {
  min-width: 0;
  padding: var(--tools-cell-padding);
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: background-color 0.2s ease;
}

.tool-category--wide {
  grid-column: span 2;
}

.tool-category--full {
  grid-column: 1 / -1;
}

.tool-category:hover {
  background: var(--surface);
}

.tool-category h2 {
  margin: 0 0 11px;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.1;
}

.tool-category-placeholder {
  margin: 0;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.tool-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-category--wide .tool-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 30px;
}

.tool-category--full .tool-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 30px;
}

.tool-category--inspiration .tool-list {
  grid-template-rows: repeat(10, auto);
  grid-auto-flow: column;
}

.tool-link {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
  text-decoration: none;
  transition:
    color 0.2s ease,
    transform 0.2s var(--ease);
}

.tool-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: translateX(2px);
}

.tool-link:focus-visible {
  border-radius: 3px;
  outline-offset: 3px;
}

.tool-link-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tool-icon {
  position: relative;
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: #050505;
}

.tool-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.tool-icon--github img {
  filter: brightness(0) invert(1);
}

.tool-icon--light {
  background: #f5f5f5;
}

.tools-noscript {
  margin: 24px 0;
  color: var(--muted);
}

.tools-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding-top: 24px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tools-footer p {
  margin: 0;
}

.tools-footer a {
  justify-self: end;
  padding: 5px 0;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--hairline-strong);
}

@media (max-width: 980px) {
  .tools-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-category--full .tool-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 734px) {
  .tools-page {
    --tools-cell-padding: 22px;
  }

  .tools-shell {
    width: calc(100% - 48px);
    padding: 78px 0 48px;
  }

  .tools-panel {
    padding: 32px 22px 24px;
  }

  .tools-intro {
    margin-bottom: 30px;
  }

  .tools-intro h1 {
    max-width: 420px;
    font-size: clamp(42px, 11vw, 54px);
  }

  .tools-intro > p:last-child {
    max-width: 430px;
    margin-top: 16px;
    font-size: 16px;
  }

  .tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-category--wide {
    grid-column: span 1;
  }

  .tool-category--wide .tool-list,
  .tool-category--full .tool-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-category--inspiration .tool-list {
    grid-template-rows: none;
    grid-auto-flow: row;
  }

  .tool-category h2 {
    font-size: 19px;
  }

  .tool-link {
    padding-block: 5px;
    font-size: 15px;
  }

  .tools-footer {
    grid-template-columns: 1fr auto;
    align-items: end;
    row-gap: 12px;
  }

  .tools-count {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .tools-footer > p:first-child {
    grid-column: 1;
    grid-row: 2;
  }

  .tools-footer a {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (max-width: 520px) {
  .tools-shell {
    width: calc(100% - 32px);
  }

  .tools-footer {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .tools-footer a {
    align-self: flex-start;
  }

  .tool-category--wide .tool-list {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-link,
  .tool-category {
    transition: none;
  }
}
