/* ── More Related Tools ───────────────────────────────────────────────
   The one shared "More Related Tools" carousel. Markup is written by
   scripts/build-more-tools.mjs between more-tools markers (never by hand);
   buttons and progress come from /scripts/more-tools.js. Every page that
   shows it loads this file and that script.

   One row of small tiles for the Other Tools utilities that scrolls
   sideways with CSS scroll snap: swipe on phones (the next tile peeks in),
   arrows on wider screens. Each tile takes its category colour pair from
   the /tools/ landing. Sizes come from CSS alone, so the script never
   moves the layout.

   Two placements, same look:
   - .landing-section.more-tools: foot of a header tool landing, which
     sets the page width and gutters (page-template.css).
   - .more-tools--inline: last block inside a tool page's
     .tools-container, which already has its gutters. */
.more-tools { --more-gutter: 24px; }
.landing-section.more-tools { padding-bottom: 64px; }
.more-tools--inline { margin-top: 56px; }

@media (max-width: 700px) {
  .tools-container .more-tools { --more-gutter: 16px; }
  .more-tools--inline { margin-top: 40px; }
}

.more-tools-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 16px;
}

.more-tools-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--txt);
}

.more-tools-lede {
  margin: 4px 0 0;
  font-size: var(--text-small);
  line-height: 1.5;
  color: var(--txt-3);
}

.more-tools-lede a { color: var(--primary-ink); font-weight: 600; text-decoration: none; }
.more-tools-lede a:hover { text-decoration: underline; }

.more-tools-nav { display: flex; gap: 8px; }
.more-tools-nav[hidden] { display: none; }

.more-tools-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--txt-2);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}

.more-tools-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-ink); }
.more-tools-btn:disabled { color: var(--txt-4); background: var(--surface2); cursor: default; }
.more-tools-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.more-tools-track {
  --more-gap: 16px;
  --more-across: 3.4;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--more-across) - 0.4) * var(--more-gap)) / var(--more-across));
  gap: var(--more-gap);
  margin: 0 -4px;
  padding: 4px 4px 8px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px;
  scrollbar-width: none;
}

.more-tools-track::-webkit-scrollbar { display: none; }
.more-tools-track > li { display: flex; min-width: 0; scroll-snap-align: start; }

@media (prefers-reduced-motion: no-preference) {
  .more-tools-track { scroll-behavior: smooth; }
}

.more-tools-tile--email   { --cat: var(--rtype-mx-fg);     --cat-bg: var(--rtype-mx-bg); }
.more-tools-tile--search  { --cat: var(--rtype-txt-fg);    --cat-bg: var(--rtype-txt-bg); }
.more-tools-tile--certs   { --cat: var(--rtype-dnssec-fg); --cat-bg: var(--rtype-dnssec-bg); }
.more-tools-tile--network { --cat: var(--rtype-cname-fg);  --cat-bg: var(--rtype-cname-bg); }
.more-tools-tile--ip      { --cat: var(--rtype-srv-fg);    --cat-bg: var(--rtype-srv-bg); }
.more-tools-tile--dns     { --cat: var(--rtype-ns-fg);     --cat-bg: var(--rtype-ns-bg); }

.more-tools-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 2px 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--txt);
  text-decoration: none;
  transition: border-color var(--t-fast);
}

/* Two classes, so a page rule such as `.cax-page a` can't recolour the tile. */
.more-tools .more-tools-tile { color: var(--txt); }

.more-tools-tile:hover { border-color: color-mix(in srgb, var(--cat) 55%, var(--border)); }
.more-tools-tile:hover .more-tools-name { color: var(--primary-ink); }
.more-tools-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.more-tools-icon {
  display: flex;
  grid-row: span 3;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--cat-bg);
  color: var(--cat);
}

.more-tools-icon svg { width: 17px; height: 17px; }
.more-tools-cat { font-size: var(--text-caption); font-weight: 700; color: var(--cat); }
.more-tools-name { font-size: 15px; font-weight: 700; line-height: 1.3; }
.more-tools-desc { font-size: 13px; line-height: 1.45; color: var(--txt-3); }

.more-tools-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 18px;
  margin-top: 10px;
}

.more-tools-progress span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  transition: width var(--t-fast), background var(--t-fast);
}

.more-tools-progress span.is-on { width: 18px; background: var(--primary); }

.more-tools-progress.is-count {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--txt-3);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .more-tools-progress span { transition: none; }
}

@media (max-width: 860px) {
  .more-tools-track { --more-across: 2.3; }
}

/* Phones: swipe edge to edge, the next tile peeks in, no arrows. */
@media (max-width: 560px) {
  .landing-section.more-tools { padding-bottom: 48px; }
  .more-tools-track {
    --more-gap: 12px;
    grid-auto-columns: 72%;
    margin: 0 calc(-1 * var(--more-gutter));
    padding-inline: var(--more-gutter);
    scroll-padding-inline: var(--more-gutter);
  }
  .more-tools-nav:not([hidden]) { display: none; }
}

