/* LegitInformant — Trust & Safety Toolkit
 * -----------------------------------------------------------------------
 * Loaded only on /tools pages, on top of app.css. It introduces no new
 * colour tokens: every tool reuses the verdict palette so a green readout
 * on a password page means exactly what a green verdict means on a scan
 * record. The evidence ledger (.exhibit, in app.css) is reused verbatim —
 * that repetition is the point, not laziness.
 */

/* --- Page furniture ---------------------------------------------------- */

.crumbs {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  padding-top: 1.6rem;
}
.crumbs a { color: var(--ink-faint); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span { margin: 0 0.45rem; }

.tool-head { padding: 0.9rem 0 1.6rem; }
.tool-head h1 {
  font-size: clamp(1.6rem, 4.2vw, 2.4rem);
  max-width: 20ch;
  margin-bottom: 0.7rem;
}
.tool-head .lede {
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0;
}

/* The privacy line. On a page where people paste passwords, bank details and
   their own email headers, this is load-bearing product copy. */
.privacy {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 1.2rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--v-ok);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--v-ok-bg);
  font-size: 0.86rem;
  color: var(--ink-soft);
  max-width: 62ch;
}
.privacy b { color: var(--ink); font-weight: 500; }
.privacy svg { flex: none; margin-top: 0.15rem; color: var(--v-ok); }
.privacy[data-net="true"] { border-left-color: var(--v-caution); background: var(--v-caution-bg); }
.privacy[data-net="true"] svg { color: var(--v-caution); }

/* --- The input slab ---------------------------------------------------- */

.toolbox {
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--paper-raised);
  padding: 1.2rem clamp(1rem, 3vw, 1.4rem);
}
.toolbox > label,
.toolbox legend.fl {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  padding: 0;
}
.toolbox .hint {
  color: var(--ink-soft);
  font-size: 0.84rem;
  margin: 0.6rem 0 0;
}
.toolbox .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
  align-items: center;
}
.toolbox .actions .spacer { flex: 1 1 auto; }

.btn-sm {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.86rem;
  padding: 0.45rem 0.85rem;
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
}
.btn-sm:hover { border-color: var(--ink); background: var(--paper-sunk); }
.btn-sm[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-sm[disabled]:hover { border-color: var(--rule-strong); background: transparent; }

/* Segmented control: hash algorithm, generator mode, character sets. Radios
   underneath so it is keyboard and screen-reader native. */
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.88rem;
  white-space: nowrap;
}
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label:has(input:checked) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.seg label:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }

.rangerow { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.rangerow input[type="range"] { flex: 1 1 190px; accent-color: var(--ink); min-width: 150px; }
.rangerow output {
  font-family: var(--mono);
  font-size: 1rem;
  min-width: 2.4ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.checkrow { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; }
.checkrow label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkrow input { accent-color: var(--ink); }

/* --- Drop zone (QR, hash, EXIF) ---------------------------------------- */

.drop {
  border: 1.5px dashed var(--rule-strong);
  border-radius: var(--r);
  background: var(--paper-sunk);
  padding: 2rem 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
  /* It behaves as a button, so it needs a button's touch handling. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(20, 23, 28, 0.12);
}
.drop:hover, .drop:focus-visible { border-color: var(--ink); }
.drop[data-over="true"] { border-color: var(--ink); border-style: solid; background: var(--paper-raised); }
.drop p { margin: 0 0 0.3rem; font-weight: 500; }
.drop .sub { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
.drop input[type="file"] { position: absolute; opacity: 0; width: 0; height: 0; }

.thumb {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.thumb img {
  max-width: 132px;
  max-height: 132px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--paper-sunk);
}
.thumb .meta { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft); }
.thumb .meta b { display: block; color: var(--ink); font-weight: 500; word-break: break-all; }

/* --- Results ----------------------------------------------------------- */

.tool-out { margin-top: 1.8rem; }
.tool-out:empty { margin-top: 0; }

/* Reuses the .verdict band from app.css, so semantics stay identical
   site-wide. This only handles the tool-specific headline sizing. */
.readout h2 {
  font-size: clamp(1.2rem, 3.2vw, 1.6rem);
  margin-bottom: 0.5rem;
}
.readout .summary { color: var(--ink-soft); margin: 0; max-width: 68ch; }

/* Key/value data block: the workhorse of every tool result. */
.kv { margin: 0; }
.kv div {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) 1fr;
  gap: 0 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}
.kv div:last-child { border-bottom: 1px solid var(--rule); }
.kv dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
  padding-top: 0.12rem;
}
.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  /* Sizes, counts and bit figures sit in a column and must not jitter. */
  font-variant-numeric: tabular-nums;
}
.kv dd.plain { font-family: var(--body); font-size: 0.95rem; }
.kv dd .ok { color: var(--v-ok); }
.kv dd .bad { color: var(--v-risk); }
.kv dd .warn { color: var(--v-caution); }
@media (max-width: 560px) {
  .kv div { grid-template-columns: 1fr; gap: 0.15rem; }
}

.sub-h {
  font-family: var(--body);
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  margin: 2rem 0 0.5rem;
}

/* A value the reader is meant to copy: hash, passphrase, decoded URL. */
.copyline {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-bottom: 0.5rem;
}
.copyline code {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.92rem;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.6rem 0.7rem;
  overflow-wrap: anywhere;
  min-width: 0;
}
.copyline button { flex: none; }

.out-block {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 0.8rem 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 26rem;
  overflow-y: auto;
  margin: 0;
}

/* --- Mail hop chain ---------------------------------------------------- */

.hops { list-style: none; margin: 0; padding: 0; }
.hops li {
  position: relative;
  padding: 0.75rem 0 0.75rem 2.1rem;
  border-top: 1px solid var(--rule);
}
.hops li:last-child { border-bottom: 1px solid var(--rule); }
.hops li::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-faint);
}
/* The vertical rule that makes a list of Received lines read as a route. */
.hops li::after {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 1.7rem;
  bottom: -0.1rem;
  width: 1px;
  background: var(--rule);
}
.hops li:last-child::after { display: none; }
.hops .host { font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; }
.hops .host b { font-weight: 500; }
.hops .det { font-size: 0.84rem; color: var(--ink-soft); margin: 0.15rem 0 0; }
.hops li[data-origin="true"] { background: var(--paper-sunk); }
.hops li[data-origin="true"] .host b { color: var(--v-caution); }

.tag {
  display: inline-block;
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  border: 1px solid currentColor;
  margin-left: 0.4rem;
  white-space: nowrap;
  vertical-align: 0.08em;
}
.tag[data-s="pass"] { color: var(--v-ok); }
.tag[data-s="fail"] { color: var(--v-risk); }
.tag[data-s="soft"] { color: var(--v-caution); }
.tag[data-s="none"] { color: var(--ink-faint); }

/* --- Character inspector ----------------------------------------------- */

.charmap { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.2rem 0 0; }
.charmap .ch {
  min-width: 2.1rem;
  text-align: center;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--paper-raised);
  padding: 0.3rem 0.25rem 0.2rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.1;
}
.charmap .ch small {
  display: block;
  font-size: 0.56rem;
  color: var(--ink-faint);
  letter-spacing: 0;
  margin-top: 0.15rem;
}
.charmap .ch[data-risk="bad"] {
  border-color: var(--v-risk);
  background: var(--v-risk-bg);
  color: var(--v-risk);
}
.charmap .ch[data-risk="bad"] small { color: var(--v-risk); }
.charmap .ch[data-risk="hidden"] {
  border-style: dashed;
  border-color: var(--v-caution);
  background: var(--v-caution-bg);
  color: var(--v-caution);
}
.charmap .ch[data-risk="hidden"] small { color: var(--v-caution); }

/* --- Strength meter ---------------------------------------------------- */

.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  overflow: hidden;
  margin: 0.7rem 0 0.5rem;
}
/* Scaled rather than resized: animating width forces layout on every frame,
   whereas a transform is handled by the compositor. --fill is 0 to 1. */
.meter i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(var(--fill, 0));
  transform-origin: left center;
  background: var(--vc, var(--ink-faint));
  transition: transform 0.25s ease;
}
@media (prefers-reduced-motion: reduce) { .meter i { transition: none; } }

/* --- Hub --------------------------------------------------------------- */

.hub-cat { margin-top: 2.8rem; }
.hub-cat > h2 { font-size: 1.24rem; margin-bottom: 0.25rem; }
.hub-cat > p.cat-blurb {
  color: var(--ink-soft);
  font-size: 0.94rem;
  max-width: 60ch;
  margin: 0 0 1.1rem;
}

.hub-grid { display: grid; gap: 0.9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .hub-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .hub-grid { grid-template-columns: repeat(3, 1fr); } }

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper-raised);
  padding: 1rem 1.1rem 1.1rem;
  text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.hub-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.hub-card h3 {
  font-family: var(--body);
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: 0;
  line-height: 1.35;
}
.hub-card p { font-size: 0.89rem; color: var(--ink-soft); margin: 0; }
.hub-card .badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: auto;
  padding-top: 0.55rem;
}
@media (prefers-reduced-motion: reduce) { .hub-card:hover { transform: none; } }

/* --- FAQ + related ----------------------------------------------------- */

.faq { margin-top: 3rem; max-width: 68ch; }
.faq > h2 { font-size: 1.24rem; margin-bottom: 0.9rem; }
.faq details {
  border-top: 1px solid var(--rule);
  padding: 0.85rem 0;
}
.faq details:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--ink-faint);
  flex: none;
}
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }

.related { margin-top: 3rem; }
.related > h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }

/* --- Utility ----------------------------------------------------------- */

/* Announcements for screen readers when a result appears without a page move. */
.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;
}

.err {
  border-left: 3px solid var(--v-risk);
  background: var(--v-risk-bg);
  padding: 0.75rem 0.95rem;
  border-radius: 0 var(--r) var(--r) 0;
  font-size: 0.93rem;
}

.busy { opacity: 0.55; }

.nojs {
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 1.4rem;
}
