/* AI tools page. Loaded only on /tools. No new colours. */

html:has(body.tools) { scroll-padding-top: 4rem; }
body.tools header.top,
body.tools header.top * { scroll-margin-top: -4rem; }

@media (prefers-reduced-motion: no-preference) {
  html:has(body.tools) { scroll-behavior: smooth; }
}

html:not(.js) .needs-js { display: none !important; }

body.tools .sr-comma { font-size: 0; }

body.tools article.tool { scroll-margin-top: 1rem; }

body.tools .vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tools .col { max-width: 35rem; }

body.tools h1,
body.tools h2,
body.tools .kname,
body.tools .kjob,
body.tools .chip { text-wrap: balance; }

body.tools main :is(h3, h4, h5, dt) { text-wrap: balance; }
body.tools main :is(p, dd, li, .sum-d) { text-wrap: pretty; }

body.tools main h2 {
  font-size: var(--t4);
  font-weight: 620;
  letter-spacing: -0.02em;
  text-transform: none;
  line-height: 1.2;
}

body.tools .sub,
body.tools .mlead,
body.tools .kmeta,
body.tools .indep,
body.tools .kind-meta { text-wrap: pretty; }

body.tools .sub {
  margin: 0.4rem 0 0;
  font-size: var(--t2);
  line-height: 1.5;
}

body.tools .indep {
  margin: 16px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--muted);
}

body.tools .indep p { margin: 0 0 0.7rem; }
body.tools .indep p:last-child { margin-bottom: 0; }

body.tools .map { margin: 28px 0 2rem; }
body.tools .map > h2,
body.tools .mlead { max-width: 35rem; }

body.tools .mlead {
  margin: 0.4rem 0 0.8rem;
  color: var(--soft);
  font-size: var(--t1);
}

body.tools .tools-skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tools .tools-skip:focus {
  position: static;
  width: auto;
  height: auto;
  min-height: 44px;
  margin: 0 0 0.8rem;
  padding: 8px 14px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  display: inline-flex;
  align-items: center;
  color: var(--accent-2);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 999px;
  text-decoration: none;
}

body.tools .spine {
  list-style: none;
  margin: 0;
  padding: 0 0 0 22px;
  border-left: 0;
  position: relative;
}

body.tools .spine::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--muted);
}

body.tools .map .node {
  margin: 0 0 1.35rem;
  padding: 0;
  background: none;
  border: 0;
  transition: none;
  scroll-margin-top: 1rem;
}
body.tools .map .node:last-child { margin-bottom: 0; }

body.tools .bub {
  position: relative;
  padding: 8px 14px;
  border: 1px solid var(--muted);
  border-radius: 18px;
}

body.tools .bub::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 1.7rem;
  width: 22px;
  height: 1.5px;
  background: var(--muted);
}

body.tools .kname { margin: 0; font-size: var(--t3); }
body.tools .kjob { margin: 0.25rem 0 0; color: var(--muted); font-size: var(--t2); }

body.tools .kmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0.45rem 0 0;
  color: var(--soft);
  font-size: var(--t1);
  font-variant-numeric: tabular-nums;
}

body.tools main .sep { display: none; }

body.tools .checklink {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

body.tools .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

body.tools .chips > li { flex: none; max-width: 100%; }

body.tools a.chip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 2px;
  max-width: 100%;
  min-height: 44px;
  padding: 6px 14px;
  color: var(--accent-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9375rem;
  text-decoration: none;
}

body.tools a.chip.stay { flex-wrap: nowrap; align-items: baseline; }
body.tools a.chip.stay .cn { min-width: 0; }

body.tools a.chip .cn { color: var(--accent-2); }
body.tools a.chip .cm { margin-left: 0.3em; color: var(--soft); font-size: 0.8125rem; }
body.tools a.chip .paid { margin-left: 0.45rem; color: var(--muted); font-size: 0.8125rem; display: inline-block; }
body.tools a.chip .ext { color: var(--soft); margin-left: 0.2rem; }
body.tools a.chip:hover .cn { text-decoration: underline; }

body.tools .want { margin: 0.8rem 0 0.4rem; }
body.tools .want label { display: block; margin: 0 0 0.35rem; }

body.tools select {
  width: 100%;
  min-height: 48px;
  padding: 0.4rem 0.7rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 8px;
  font: inherit;
  font-size: var(--t2);
}

body.tools .status { min-height: 4.75em; margin: 0.6rem 0 1.2rem; }

body.tools .kind { margin: 0 0 2rem; padding: 0.15rem 0 0.15rem 0.9rem; }
body.tools .kind.is-match { box-shadow: inset 3px 0 0 var(--muted); }
body.tools .node.is-match .bub { box-shadow: inset 3px 0 0 var(--muted); }

body.tools .kind-head { position: relative; }
body.tools .kind-head h3 { margin: 0; padding-right: 6.5rem; }

body.tools .match {
  position: absolute;
  top: 0;
  right: 0;
  visibility: hidden;
  margin: 0;
  padding: 2px 10px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 999px;
  font-size: var(--t1);
}

body.tools .bub .match {
  position: static;
  margin: 0 0 0 4px;
  padding: 2px 8px;
}

body.tools .kind.is-match .match,
body.tools .node.is-match .match { visibility: visible; }

body.tools .jl {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

body.tools .jl a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  text-wrap: balance;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: var(--t1);
  line-height: 1.3;
  color: var(--accent-2);
  text-decoration: none;
}

body.tools .nw { white-space: nowrap; }

body.tools .gain { margin: 0.35rem 0 0.6rem; color: var(--muted); font-size: var(--t1); }
body.tools .kind-meta { color: var(--soft); font-size: var(--t1); font-variant-numeric: tabular-nums; }

body.tools details { margin: 0.35rem 0; }
body.tools details.check {
  border-left: 3px solid var(--fill);
  padding-left: 14px;
}

body.tools summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}

body.tools summary::-webkit-details-marker { display: none; }
body.tools summary .pm { width: 1rem; flex: none; color: var(--muted); }
body.tools summary .pm::before { content: "+"; }
body.tools details[open] > summary .pm::before { content: "-"; }
body.tools summary .sum { display: flex; flex-direction: column; }
body.tools summary .sum-t { font-weight: 700; color: var(--text); }
body.tools summary .sum-d { color: var(--soft); font-size: var(--t1); font-weight: 400; }

body.tools .door { padding: 0.2rem 0 0.6rem; }
body.tools .before { color: var(--muted); font-size: var(--t1); }

body.tools .steps { list-style: none; margin: 0.6rem 0; padding: 0; counter-reset: step; }
body.tools .steps > li {
  position: relative;
  margin: 0 0 0.9rem;
  padding-left: 40px;
  counter-increment: step;
}
body.tools .steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  line-height: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--muted);
  border-radius: 50%;
  font-size: var(--t1);
}
body.tools .step-text { margin: 0; font-size: var(--t2); }
body.tools .step-pass,
body.tools .step-fail { margin: 0.35rem 0 0; font-size: var(--t2); }
body.tools .catches { margin: 0.15rem 0 0; color: var(--muted); font-size: var(--t1); }

body.tools .fidelity { margin: 0.8rem 0 0.3rem; color: var(--muted); font-size: var(--t1); font-style: italic; }
body.tools .prompt-label { margin: 0 0 0.3rem; font-weight: 650; }

body.tools pre.prompt {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  background: var(--inset);
  border: 1px dashed var(--line-strong);
  font: inherit;
  font-size: var(--t1);
}

body.tools button.copy {
  min-height: 44px;
  margin-top: 0.45rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--muted);
  font-weight: 650;
}
body.tools button.copy:hover { filter: none; background: var(--inset); }

body.tools .verdict,
body.tools .qs { margin: 0.8rem 0 0; }
body.tools .verdict dt,
body.tools .qs dt { font-weight: 650; }
body.tools .verdict dd:empty { display: none; }
body.tools .verdict dd,
body.tools .qs dd { margin: 0 0 0.7rem; }

body.tools .src {
  margin: 0.2rem 0 0.4rem;
  color: var(--soft);
  font-size: var(--t1);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

body.tools .stale { margin: 0.2rem 0 0.5rem; }
body.tools .note-mark { font-weight: 700; }

body.tools blockquote {
  margin: 0.35rem 0 0.8rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--muted);
}
body.tools blockquote p { margin: 0; }

body.tools .tool { margin: 0 0 1.1rem; }
body.tools .tool h5 { margin: 0 0 0.2rem; font-size: 1rem; font-weight: 650; }

body.tools .links { margin: 0.6rem 0 0; }
body.tools .links a { display: inline-flex; align-items: center; min-height: 44px; }

body.tools .choose {
  margin: 0.4rem 0 1rem;
  padding-left: 14px;
  border-left: 2px solid var(--muted);
  list-style: none;
}
body.tools .choose li { margin: 0.35rem 0; }

body.tools .next { margin: 0.6rem 0; }
body.tools .next-second a { display: inline-flex; align-items: center; min-height: 44px; }
body.tools main a.button { color: var(--fill-ink); }

body.tools .tm { color: var(--soft); font-size: var(--t1); }

body.tools a[href^="mailto:"] { overflow-wrap: anywhere; }

body.tools table.stack { width: 100%; border-collapse: collapse; }
body.tools table.stack th,
body.tools table.stack td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  body.tools table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  body.tools table.stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  body.tools table.stack th,
  body.tools table.stack td { display: block; border: 0; padding: 2px 0; }
  body.tools table.stack td[data-h]::before {
    content: attr(data-h) ": ";
    color: var(--muted);
    font-size: var(--t1);
    font-weight: 700;
  }
}

@media (min-width: 60rem) {
  body.tools .jl { display: none; }
}

@media (min-width: 1100px) {
  body.tools .spine { padding-left: 28px; }
  body.tools .bub::before { width: 28px; }
  body.tools .node {
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    column-gap: 40px;
    align-items: start;
  }
  body.tools .chips {
    position: relative;
    margin-top: 0.4rem;
    align-content: center;
  }
  body.tools .chips::before {
    content: "";
    position: absolute;
    left: -40px;
    top: 22px;
    width: 40px;
    height: 1.5px;
    background: var(--muted);
  }
  body.tools main .sep { display: inline; }
  body.tools .checklink { flex-basis: auto; min-height: 24px; }
}

@media (forced-colors: active) {
  body.tools .map .node { border: 0; background: none; }
  body.tools .bub { border: 1px solid CanvasText; }
}
