/* ==========================================================================
   abbott.cloud tools — shared styles for /tools/*
   Builds on /styles.css (tokens, header, footer, buttons).
   Layout: a working column (form + results) beside a transparency rail
   ("How this works" + the live request log), stacked on narrow screens.
   ========================================================================== */

:root {
  --panel: rgb(255 255 255 / .028);
  --panel-2: rgb(255 255 255 / .05);
  --panel-3: rgb(255 255 255 / .08);
  --pass: #5af0a0;
  --warn: #f5c451;
  --fail: #ff7d7d;
  --info: #9fb7ff;
  --field: rgb(255 255 255 / .04);
  --field-focus: rgb(255 255 255 / .07);
  --mono-size: 13.5px;
}

body.tool { grid-template-rows: auto 1fr auto; }

/* Static, quiet background: no shader on working pages */
.tool-bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(70% 45% at 15% -5%, rgb(255 255 255 / .05), transparent 70%),
    radial-gradient(50% 40% at 95% 0%, rgb(255 255 255 / .03), transparent 70%),
    var(--bg);
}
.tool .grid { opacity: .6; -webkit-mask-image: radial-gradient(ellipse 80% 50% at 30% 0%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse 80% 50% at 30% 0%, #000 10%, transparent 70%); }

/* Header navigation */
.tool-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-nav a {
  padding: 7px 12px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  transition: background .2s, color .2s;
}
.tool-nav a:hover { background: var(--panel-2); color: var(--ink); }
.tool-nav a[aria-current="page"] { color: var(--ink); background: var(--panel-2); }

/* Page frame */
.tool-main {
  width: 100%; max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 56px) var(--gutter) 64px;
  min-width: 0;
}
.crumbs { margin: 0 0 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs span[aria-hidden] { margin: 0 6px; }

.tool-head { display: grid; gap: 12px; margin-bottom: clamp(22px, 4vh, 34px); max-width: 76ch; }
.tool-head h1 {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1; letter-spacing: -.045em; font-weight: 640;
  text-wrap: balance;
}
.tool-head .lede { margin: 0; font-size: clamp(1rem, 1.5vw, 1.15rem); line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }

/* Where the work happens */
.runs-on { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 0; padding: 0; list-style: none; }
.runs-on li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 9px; border-radius: 999px;
  font-size: 12.5px; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--line);
}
.runs-on li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.runs-on li.device::before { background: var(--pass); box-shadow: 0 0 8px var(--pass); }
.runs-on li.network::before { background: var(--info); box-shadow: 0 0 8px var(--info); }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.tool-work { display: grid; gap: 18px; min-width: 0; }
.tool-rail { display: grid; gap: 14px; min-width: 0; position: sticky; top: 16px; }
@media (max-width: 980px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .tool-rail { position: static; }
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(16px, 2vw, 22px);
  min-width: 0;
}
.panel > h2, .rail-section > h2 {
  margin: 0 0 12px;
  font-size: 11.5px; font-weight: 550; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3);
}

/* Forms */
.tool-form { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label, .field > .label, fieldset > legend {
  font-size: 12.5px; font-weight: 550; color: var(--ink-2); letter-spacing: .01em;
}
.field .hint, .hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .grow { flex: 1 1 260px; min-width: 0; }

.input, .select, .textarea {
  width: 100%; min-width: 0;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
  transition: border-color .15s, background .15s;
}
.input.mono, .textarea.mono, .input[type="search"].mono { font-family: var(--font-mono); font-size: 14.5px; letter-spacing: -.01em; }
.input.big { font-size: 17px; padding: 13px 15px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.select option { background: #111318; color: var(--ink); }
.input:hover, .select:hover, .textarea:hover { border-color: rgb(255 255 255 / .26); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink-2); background: var(--field-focus); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 1px; }
.input[aria-invalid="true"] { border-color: var(--fail); }
::placeholder { color: rgb(244 245 248 / .32); }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

fieldset.field, fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 7px; }

/* Segmented control: radio inputs styled as a pill group */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0; border: 1px solid var(--line-2); border-radius: 12px; background: var(--field); }
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: block; padding: 7px 12px; border-radius: 8px;
  font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
  transition: background .15s, color .15s;
}
.segmented input:checked + span { background: var(--ink); color: #0a0b10; font-weight: 550; }
.segmented input:focus-visible + span { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.segmented label:hover input:not(:checked) + span { background: var(--panel-3); color: var(--ink); }

/* Buttons sized for forms (re-uses .btn from styles.css) */
.tool .btn { height: 46px; padding: 0 18px; font-size: 14.5px; transform: none; }
.tool .btn-primary { box-shadow: 0 0 0 1px rgb(255 255 255 / .4) inset; }
.tool .btn-primary:hover { box-shadow: 0 0 0 1px rgb(255 255 255 / .7) inset, 0 8px 30px -10px rgb(255 255 255 / .35); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: progress; }
.btn-small { height: 32px !important; padding: 0 11px !important; font-size: 12.5px !important; border-radius: 9px !important; gap: 6px !important; }
.btn-ghost.btn-small { background: var(--panel-2); backdrop-filter: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-3); }
.examples button {
  font: inherit; font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 3px 8px; cursor: pointer;
}
.examples button:hover { color: var(--ink); border-color: var(--line-2); }

/* Results */
.results { display: grid; gap: 16px; min-width: 0; }
.results[aria-busy="true"] { opacity: .6; transition: opacity .2s; }
.results:empty { display: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 0;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.015em; }
.card-head .sub { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
.card-head .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.card-body { padding: 14px 18px 18px; display: grid; gap: 14px; min-width: 0; }
.card-body > p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }

/* Summary strip of big numbers / verdicts */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.summary .stat { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.summary .stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); }
.summary .stat-value { margin-top: 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.summary .stat-value.mono { font-family: var(--font-mono); font-size: 19px; }
.summary .stat-note { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }

/* Status chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 550; line-height: 1.4; white-space: nowrap;
  color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.pass { color: var(--pass); background: rgb(90 240 160 / .08); border-color: rgb(90 240 160 / .25); }
.chip.warn { color: var(--warn); background: rgb(245 196 81 / .08); border-color: rgb(245 196 81 / .28); }
.chip.fail { color: var(--fail); background: rgb(255 125 125 / .08); border-color: rgb(255 125 125 / .28); }
.chip.info { color: var(--info); background: rgb(159 183 255 / .08); border-color: rgb(159 183 255 / .25); }
.chip.neutral::before { background: var(--ink-3); }

/* Findings list: one line per check with a status marker */
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.findings li {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
}
.findings li:first-child { border-top: 0; }
.findings li::before {
  content: ""; width: 8px; height: 8px; margin: 7px 0 0 4px; border-radius: 50%; background: var(--ink-3);
}
.findings li.pass::before { background: var(--pass); }
.findings li.warn::before { background: var(--warn); }
.findings li.fail::before { background: var(--fail); }
.findings li.info::before { background: var(--info); }
.findings strong { color: var(--ink); font-weight: 600; }
.findings .more { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); }

/* Key–value lists */
.kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono, .kv .mono { font-family: var(--font-mono); font-size: var(--mono-size); }
@media (max-width: 520px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .kv dd { margin-bottom: 8px; } }

/* Tables */
.table-wrap { position: relative; overflow-x: auto; min-width: 0; border-radius: 10px; border: 1px solid var(--line); }
.table-wrap:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data caption { text-align: left; padding: 10px 12px; color: var(--ink-3); font-size: 12.5px; }
table.data th {
  text-align: left; font-weight: 550; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); padding: 9px 12px; background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink); }
table.data tr:first-child td { border-top: 0; }
table.data td.mono, table.data .mono { font-family: var(--font-mono); font-size: var(--mono-size); }
table.data td.wrap { overflow-wrap: anywhere; min-width: 16ch; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.muted { color: var(--ink-3); }
table.data tbody tr:hover td { background: rgb(255 255 255 / .02); }

/* Code and raw data */
.code {
  position: relative; margin: 0;
  font-family: var(--font-mono); font-size: var(--mono-size); line-height: 1.55;
  color: var(--ink); background: rgb(0 0 0 / .35);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; white-space: pre; tab-size: 2;
}
.code.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-block { display: grid; gap: 6px; min-width: 0; }
.code-block .code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.code-block .code-head .btn { color: var(--ink-2); }
.code-block .code-head .btn:hover { color: var(--ink); }
.mono { font-family: var(--font-mono); }
code.inline { font-family: var(--font-mono); font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
mark.hl { background: rgb(245 196 81 / .18); color: var(--ink); border-radius: 3px; padding: 0 2px; }

/* Notices */
.notice {
  display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 14.5px; line-height: 1.5; color: var(--ink-2);
}
.notice::before { content: ""; border-radius: 4px; background: var(--ink-3); }
.notice.info::before { background: var(--info); }
.notice.warn::before { background: var(--warn); }
.notice.error::before { background: var(--fail); }
.notice.success::before { background: var(--pass); }
.notice strong { display: block; color: var(--ink); margin-bottom: 2px; font-weight: 600; }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }

/* Disclosure sections */
details.more-detail { border-top: 1px solid var(--line); padding-top: 10px; }
details.more-detail > summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 8px; }
details.more-detail > summary::-webkit-details-marker { display: none; }
details.more-detail > summary::before { content: "▸"; font-size: 11px; transition: transform .2s; }
details.more-detail[open] > summary::before { transform: rotate(90deg); }
details.more-detail > summary:hover { color: var(--ink); }
details.more-detail > *:not(summary) { margin-top: 10px; }

/* Tree (SPF includes, certificate chains, redirect hops) */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 10px; padding-left: 16px; border-left: 1px dashed var(--line-2); }
.tree li { padding: 5px 0; min-width: 0; }
.tree .node { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: 14px; }
.tree .node .mono { font-size: var(--mono-size); overflow-wrap: anywhere; }

/* Empty and loading states */
.empty {
  padding: 28px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: 16px;
  color: var(--ink-3); font-size: 14.5px;
}
.loading { display: flex; align-items: center; gap: 12px; padding: 18px; color: var(--ink-2); font-size: 14.5px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin-360 .8s linear infinite; }
@keyframes spin-360 { to { transform: rotate(360deg); } }

/* Transparency rail */
.rail-section {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; min-width: 0;
}
.how { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.how p { margin: 0 0 10px; }
.how ol, .how ul { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; }
.how li::marker { color: var(--ink-3); }
.how strong { color: var(--ink); font-weight: 600; }
.how a { color: var(--ink); text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
.how .code-links { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.how .code-links a { color: var(--ink-2); }

.log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.log-head h2 { margin: 0; font-size: 11.5px; font-weight: 550; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3); }
.log-empty { margin: 0; font-size: 13px; color: var(--ink-3); }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; overscroll-behavior: contain; }
.log li { border: 1px solid var(--line); border-radius: 10px; background: rgb(0 0 0 / .2); min-width: 0; }
.log details > summary {
  list-style: none; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px;
  padding: 8px 10px; font-size: 12.5px;
}
.log details > summary::-webkit-details-marker { display: none; }
.log .log-what { font-family: var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.log .log-meta { font-family: var(--font-mono); color: var(--ink-3); text-align: right; white-space: nowrap; }
.log .log-why { grid-column: 1 / -1; color: var(--ink-3); }
.log .log-body { padding: 0 10px 10px; display: grid; gap: 8px; }
.log .log-body .code { font-size: 11.5px; max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.log li.err .log-meta { color: var(--fail); }

/* Hub */
.hub-search { max-width: 520px; margin-bottom: 26px; }
.hub-group { margin-top: 30px; }
.hub-group:first-of-type { margin-top: 0; }
.hub-group > h2 { margin: 0 0 12px; font-size: 11.5px; font-weight: 550; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-3); }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.tool-card {
  display: grid; gap: 8px; align-content: start;
  padding: 16px 18px 18px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line);
  color: inherit; text-decoration: none; min-width: 0;
  transition: border-color .2s, background .2s, transform .3s var(--ease-out);
}
.tool-card:hover { border-color: var(--line-2); background: var(--panel-2); transform: translateY(-2px); }
.tool-card h3 { margin: 0; font-size: 16.5px; font-weight: 600; letter-spacing: -.015em; }
.tool-card p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.tool-card .runs { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px; }
.tool-card .runs::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pass); }
.tool-card .runs.network::before { background: var(--info); }
.tool-card[hidden] { display: none; }
.hub-none { color: var(--ink-3); }

.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 0 0 30px; padding: 0; list-style: none; }
.principles li { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.principles strong { display: block; color: var(--ink); margin-bottom: 3px; font-weight: 600; }

.card-body h3.sub-head { margin: 4px 0 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }

/* Long unbroken strings (URLs, IPv6 ranges, DKIM-style names, issuer URLs) must wrap
   instead of widening a card or being clipped by it. Grid columns and collapsible
   sections may shrink below their content's width; wide tables scroll inside .table-wrap. */
.card-body { grid-template-columns: minmax(0, 1fr); }
.card-head > div, details.more-detail, .findings li > div { min-width: 0; }
.card-head h2, .card-head h3, .card-head .sub, .card-body > p,
.notice p, .notice strong, .findings strong, .findings .more,
.summary .stat-note, .kv dt { overflow-wrap: anywhere; }

/* Utility */
[hidden] { display: none !important; }
.stack { display: grid; gap: 12px; min-width: 0; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 560px) {
  .tool-main { padding-top: 24px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  .row > .btn { flex: 1 1 auto; justify-content: center; }
}

@media print {
  .tool-rail, .top, .foot, .tool-bg, .grid, .grain { display: none !important; }
  .tool-layout { grid-template-columns: 1fr; }
}

/* A table row that needs attention (table({ rowClass })). Rows also carry a chip in words. */
table.data tr.flag td { background: rgb(245 196 81 / .07); }
table.data tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
