/* DNS Health Checker: see docs/DESIGN.md. Ledger look: cool paper, hairlines, sans headings, mono data. */
:root {
  --paper: #f7f8fa;
  --sheet: #ffffff;
  --ink: #161a21;
  --ink-2: #5a6270;
  --rule: #e2e5ea;
  --brand: #4a3a8f;
  --brand-ink: #ffffff;
  --ok: #2c7339;
  --warn: #9a6100;
  --bad: #b02a20;
  --info: #2f5d86;
  --unk: #5e6670;
  /* Support colours: tints of the brand plus one calm sky tint. Never used for status. */
  --tint: #f0edfc;
  --soft: #cdc4f2;
  --sky: #e8f1fa;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121419;
    --sheet: #1a1d24;
    --ink: #e8eaed;
    --ink-2: #a4abb5;
    --rule: #2d323c;
    --brand: #b5a6f0;
    --brand-ink: #14111f;
    --ok: #7cc98a;
    --warn: #e6b85c;
    --bad: #f08a80;
    --info: #8db7de;
    --unk: #9aa1aa;
    --tint: #221e36;
    --soft: #4b4382;
    --sky: #16212e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
main { flex: 1 0 auto; }
a { color: var(--brand); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); font-size: 0.9em; }
.mono { font-family: var(--mono); }
code { overflow-wrap: anywhere; }
h1, h2, h3 { font-family: var(--sans); font-weight: 700; letter-spacing: -0.02em; line-height: 1.18; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.4rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 42rem; }
.label {
  font: 600 0.72rem/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--sheet); padding: 8px; z-index: 2; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Header and footer */
.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.1rem/1 var(--sans); letter-spacing: -0.015em; }
.brand .dot { color: var(--brand); }
.brand svg { width: 26px; height: 26px; flex: none; }
.nav { display: flex; gap: 20px; font-size: 0.95rem; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; }
.foot { border-top: 1px solid var(--rule); margin-top: 72px; padding: 20px 0 28px; font-size: 0.875rem; color: var(--ink-2); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.foot a { color: var(--ink-2); }

/* Forms */
.check-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 8px; max-width: 40rem; }
.check-form input[type="text"], .field input, .field textarea {
  flex: 1 1 18rem;
  min-width: 0;
  font: 1.05rem/1.4 var(--mono);
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 12px 14px;
}
.check-form input[type="text"]:focus, .field input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 1px var(--brand); }
.btn {
  font: 600 1rem/1 var(--sans);
  background: var(--brand);
  color: var(--brand-ink);
  border: 1px solid var(--brand);
  border-radius: 3px;
  padding: 13px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--brand); }
.error { color: var(--bad); font-weight: 600; }
.field { display: grid; gap: 6px; margin: 0 0 12px; }
.field label { font-weight: 600; }

/* Home */
.hero { padding: 56px 0 24px; }
.hero h1 { max-width: 20ch; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 38rem; }
.ledger { border-top: 1px solid var(--rule); margin: 32px 0 0; }
.ledger-row { display: grid; grid-template-columns: 11rem 1fr; gap: 8px 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.ledger-row h3 { font-size: 1.1rem; margin: 0; }
.ledger-row p { margin: 0; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 16px; }
.cols > div { border-top: 2px solid var(--ink); padding-top: 12px; }
section { margin-top: 56px; }

/* Status glyphs and pills */
.g { width: 1em; height: 1em; vertical-align: -0.12em; flex: none; }
.s-pass, .s-healthy { color: var(--ok); }
.s-warning, .s-attention { color: var(--warn); }
.s-fail, .s-problems { color: var(--bad); }
.s-info { color: var(--info); }
.s-unable { color: var(--unk); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 0.8rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 8px; border: 1px solid currentColor; border-radius: 3px; white-space: nowrap; }

/* Report */
.report { display: grid; grid-template-columns: 17rem 1fr; gap: 40px; margin-top: 32px; }
.rail { position: sticky; top: 16px; align-self: start; }
.rail h1 { font-size: 1.3rem; font-weight: 600; overflow-wrap: anywhere; margin: 4px 0 0; }
.rail .overall { font: 700 1.5rem/1.2 var(--sans); letter-spacing: -0.015em; display: flex; gap: 10px; align-items: center; margin: 8px 0 4px; }
.rail .overall .g { width: 1.1em; height: 1.1em; }
.chain { list-style: none; margin: 20px 0; padding: 0; font-family: var(--mono); font-size: 0.9rem; }
.chain li { position: relative; padding: 0 0 14px 22px; overflow-wrap: anywhere; }
.chain li::before { content: ""; position: absolute; left: 4px; top: 0.45em; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.chain li::after { content: ""; position: absolute; left: 8px; top: 1.1em; bottom: -0.2em; width: 1px; background: var(--rule); }
.chain li:last-child::after { display: none; }
.chain li.zone::before { background: var(--brand); width: 11px; height: 11px; left: 3px; }
.chain li.entered::before { background: transparent; border: 2px solid var(--ink-2); }
.rail dl { margin: 0; display: grid; gap: 10px; }
.rail dt { font: 600 0.72rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.rail dd { margin: 0; }
.rail .jump { display: grid; gap: 4px; margin-top: 20px; font-size: 0.95rem; }
.area { border-top: 2px solid var(--ink); padding-top: 14px; margin-bottom: 40px; }
.area > header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.area > header h2 { margin: 0; }
.area h3 { margin: 24px 0 8px; }
.area .checked { color: var(--ink-2); font-size: 0.95rem; margin: 8px 0 16px; }
.findings { list-style: none; margin: 0; padding: 0; }
.finding { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0 8px; padding: 12px 0; border-top: 1px solid var(--rule); }
.finding > .g { margin-top: 0.3em; }
.finding p { margin: 0; }
.finding .why { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }
.finding details { margin-top: 6px; font-size: 0.95rem; }
.finding summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.records { margin: 12px 0 0; }
.records summary { cursor: pointer; font-weight: 600; }
pre {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 12px;
  overflow-x: auto;
  white-space: pre;
  font-size: 0.82rem;
  line-height: 1.5;
  max-height: 26rem;
}
.note { border-left: 3px solid var(--warn); padding: 8px 12px; background: var(--sheet); margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font: 600 0.72rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.tablewrap { overflow-x: auto; }

/* Badge section */
.badge-pick { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0; }
.badge-pick a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; color: var(--ink); }
.badge-pick a[aria-current="true"] { border-color: var(--brand); color: var(--brand); }
.preview { padding: 20px; border: 1px dashed var(--rule); border-radius: 3px; margin: 12px 0; display: flex; align-items: center; justify-content: center; min-height: 96px; }
.preview.dark { background: #0d0f13; }
.preview.light { background: #ffffff; }
textarea.code { width: 100%; min-height: 7.5rem; font: 0.85rem/1.5 var(--mono); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 10px; resize: vertical; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 40px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ink); font: 600 0.85rem/24px var(--mono); text-align: center; }

/* List of reports */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0 8px; }
.filters .field { margin: 0; }
.filters select, .filters input { font: 0.95rem/1.3 var(--sans); padding: 9px 10px; border: 1px solid var(--rule); border-radius: 3px; background: var(--sheet); color: var(--ink); }
.letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0; font-family: var(--mono); }
.letters a, .letters span { min-width: 2.1rem; text-align: center; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 3px; text-decoration: none; }
.letters [aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }

.prose { max-width: 42rem; }
.prose h2 { margin-top: 40px; }
.faq dt { font-weight: 700; margin-top: 16px; }
.faq dd { margin: 4px 0 0; }

@media (max-width: 900px) {
  .report { grid-template-columns: 1fr; gap: 8px; }
  .rail { position: static; border-bottom: 1px solid var(--rule); padding-bottom: 16px; }
  .rail .jump { display: flex; flex-wrap: wrap; gap: 4px 16px; }
  .chain { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 12px 0; }
  .chain li { padding: 0 0 0 16px; }
  .chain li + li::before { left: 4px; }
  .chain li::after { display: none; }
  .chain li + li { margin-left: 14px; }
  .rail dl { grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; }
}
@media (max-width: 640px) {
  .ledger-row { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .nav { gap: 14px; }
}

/* Glyph details that need theme colours (no inline styles under the CSP). */
.g .x { stroke: var(--paper); }
.brand .m-line { stroke: var(--ink); }
.brand .m-node { fill: var(--ink); }
.brand .m-zone { fill: var(--brand); }

/* Illustrations and icons (src/web/art.ts) */
.art { display: block; width: 100%; height: auto; }
.art .a-soft-line { stroke: var(--soft); stroke-width: 2; fill: none; stroke-linecap: round; }
.art .a-brand-line { stroke: var(--brand); stroke-width: 2.5; fill: none; stroke-linecap: round; }
.art .a-node-line { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.art .a-dash { stroke-dasharray: 4 5; }
.art .a-node { fill: var(--ink); }
.art .a-node2 { fill: var(--ink-2); }
.art .a-soft { fill: var(--soft); }
.art .a-brand { fill: var(--brand); }
.art .a-halo { fill: var(--tint); stroke: var(--soft); stroke-width: 1; }
.art .a-hollow { fill: none; stroke: var(--soft); stroke-width: 2; stroke-dasharray: 3 3; }
.art .a-label { font: 12px var(--mono); fill: var(--ink-2); }
.art .a-strong { fill: var(--ink); font-weight: 600; }
.art .a-card { fill: var(--sheet); stroke: var(--rule); }
.art .a-bar { fill: var(--rule); }
.art .a-ok { fill: var(--ok); }
.art .a-okt { fill: var(--ok); opacity: 0.2; }
.art .a-info { fill: var(--info); }
.art .a-infot { fill: var(--info); opacity: 0.2; }
.ic { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: var(--tint); color: var(--brand); flex: none; }
.ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic .i-dot { stroke-width: 2.6; }

/* Home: tinted hero band with the delegation tree */
/* flow-root keeps the hero's top margin inside the band (no plain strip under the header). */
.band { display: flow-root; background: linear-gradient(180deg, var(--tint) 0%, var(--sky) 60%, var(--paper) 100%); }
.band .hero { margin-top: 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 32px; align-items: center; padding-bottom: 40px; }
.hero-art { width: 100%; max-width: 380px; justify-self: end; }
.ledger-row h3 { display: flex; align-items: center; gap: 12px; }
.cols .ic { margin-bottom: 12px; }
.cols > div { border-top-color: var(--brand); }
.panel { background: var(--sky); border-radius: 8px; padding: 18px 20px; }
.hero-small-art { width: 140px; margin-bottom: 16px; }

/* Report: icons in section headings, badge section as a card */
.area > header h2 { display: flex; align-items: center; gap: 10px; }
.area > header .ic { width: 30px; height: 30px; }
.area > header .ic svg { width: 18px; height: 18px; }
.area.badge-area { background: var(--sheet); border: 1px solid var(--rule); border-top: 3px solid var(--brand); border-radius: 8px; padding: 18px 20px 8px; }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: 8px; }
  .hero-art { max-width: 300px; justify-self: start; }
}
