/* dnsismagic.com
 *
 * Same approach as every other site on this host: hand-written CSS, custom
 * properties for the palette, no framework and no build step. The whole file
 * is one request and it is smaller than the loading spinner of the
 * alternative.
 *
 * The palette is sampled from the logo, and has been re-sampled once. The
 * cube used to be a green gelatinous one and the accent was its yellow-green;
 * the artwork is now an ice cube, so the accent is the ice (hue 181, which is
 * what a quantise of the drawing actually returns) and --magic is the
 * wizard's purple robe rather than his old blue hat.
 *
 * The rule the re-sample followed, worth keeping: --accent tracks the logo,
 * --ok/--warn/--fail do NOT. Those three mean something, and green-for-good
 * has to stay green even when the brand stops being green. That separation is
 * new -- while the accent was also green, --accent and --ok were nearly the
 * same colour and a link was easy to read as a verdict.
 *
 * Dark mode is the default look this was designed against; light mode is a
 * real design rather than an inversion, because half the people who open a
 * DNS tool are doing it from a bright office at 11am.
 */
:root {
  --bg: #f6f8f9;
  --panel: #ffffff;
  --panel-2: #eef2f4;
  --fg: #16202b;
  --muted: #5d6b7a;
  --line: #dde4ea;
  --line-strong: #c3cfd8;

  --accent: #10736f;
  --accent-fg: #ffffff;
  --magic: #63479f;

  --ok: #2b7333;
  --ok-bg: #e8f5e2;
  --warn: #8a6100;
  --warn-bg: #fdf2d8;
  --fail: #b1352c;
  --fail-bg: #fbe6e4;
  --none: #5d6b7a;
  --none-bg: #eef2f4;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161b22;
    --panel: #1d232c;
    --panel-2: #232b36;
    --fg: #e9edf2;
    --muted: #9aa7b4;
    --line: #2c3641;
    --line-strong: #3b4855;

    --accent: #4fd0cb;
    --accent-fg: #06211f;
    --magic: #b79ceb;

    --ok: #7fd166;
    --ok-bg: #1c3117;
    --warn: #e8bf62;
    --warn-bg: #33290f;
    --fail: #f38b80;
    --fail-bg: #3a1f1d;
    --none: #9aa7b4;
    --none-bg: #232b36;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem 4rem; }

/* ---- header ---------------------------------------------------------- */

header.site {
  display: flex; align-items: center; gap: .85rem;
  padding: 1.5rem 0 1.25rem;
}
header.site img { width: 100px; height: 100px; flex: none; }
header.site h1 {
  margin: 0; font-size: 1.6rem; letter-spacing: -.02em; font-weight: 650;
}
header.site h1 a { color: inherit; text-decoration: none; }
/* The tagline rotates per request (TAGLINES in app.py), so this line's
   content changes length between page loads. Reserving its height keeps the
   header from resizing under the cursor when a long phrase follows a short
   one -- at the 60rem wrap even the longest of them fits on one line beside
   a 100px logo, so one line is the right amount to reserve. */
header.site .tag {
  margin: .1rem 0 0; color: var(--muted); font-size: .85rem;
  min-height: 1.6em;
}
header.site nav { margin-left: auto; display: flex; gap: 1rem; font-size: .9rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }

/* ---- the search form ------------------------------------------------- */

form.ask {
  display: flex; gap: .5rem; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .6rem;
}
form.ask input[type=text] {
  flex: 1 1 18rem; min-width: 0;
  background: transparent; color: var(--fg);
  border: 0; outline: 0; padding: .55rem .6rem;
  font: 400 1.05rem/1.4 var(--mono);
}
form.ask select, form.ask button {
  border-radius: 7px; border: 1px solid var(--line-strong);
  padding: .55rem .7rem; font: 500 .92rem var(--sans);
  background: var(--panel-2); color: var(--fg); cursor: pointer;
}
form.ask button {
  background: var(--accent); color: var(--accent-fg);
  border-color: transparent; padding-inline: 1.4rem;
}
form.ask:focus-within { border-color: var(--accent); }

/* The mail form has two text inputs side by side, and with no chrome of
   their own they read as one wide field with stray grey text floating in it.
   A rule between them is enough to say they are separate. */
form.ask input[type=text] + input[type=text] {
  border-left: 1px solid var(--line);
  padding-left: .8rem;
}

/* ---- the paste form, /headers ---------------------------------------- */

/* Same shell as form.ask, stacked instead of in a row, because the input is a
   block of text rather than a name. */
form.paste {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .6rem;
}
form.paste:focus-within { border-color: var(--accent); }
form.paste textarea {
  display: block; width: 100%; resize: vertical;
  background: transparent; color: var(--fg);
  border: 0; outline: 0; padding: .55rem .6rem;
  font: 400 .88rem/1.5 var(--mono);
}
form.paste .row {
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
  border-top: 1px solid var(--line); margin-top: .4rem; padding: .7rem .6rem 0;
  font-size: .85rem;
}
form.paste button {
  margin-left: auto;
  border-radius: 7px; border: 1px solid transparent;
  padding: .55rem 1.4rem; font: 500 .92rem var(--sans);
  background: var(--accent); color: var(--accent-fg); cursor: pointer;
}
/* The native file input keeps its own chrome. Hiding it behind a styled label
   is the usual trick and it costs the filename readout, which without any
   JavaScript on this site is the only confirmation that a file was chosen. */
form.paste input[type=file] {
  font: .8rem var(--sans); color: var(--muted);
  max-width: 100%; min-width: 0;
}

/* ---- the delivery timeline ------------------------------------------- */

/* Oldest first, which is the whole point of the page: Received headers are
   prepended, so the file reads newest-first and the journey reads the other
   way. Drawn as a rule with a dot per hop rather than a table, because the
   thing being shown is a sequence and a table of rows is not one. */
ol.hops { list-style: none; margin: 0; padding: 0; }
ol.hops > li {
  position: relative;
  padding: 0 0 1.1rem 1.3rem;
  border-left: 2px solid var(--line);
}
ol.hops > li:last-child { border-left-color: transparent; padding-bottom: 0; }
ol.hops > li::before {
  content: ""; position: absolute; left: -5px; top: .45rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-strong);
}
/* The earliest public address in the chain -- what a receiver evaluated SPF
   against, and the one hop in the list a sender could not invent. */
ol.hops > li.origin::before {
  background: var(--magic); box-shadow: 0 0 0 3px var(--none-bg);
}

.hop-head {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
}
.hop-head .num {
  font: 700 .7rem var(--mono); color: var(--muted);
  min-width: 1.2rem;
}
.hop-head .ip { font: 600 .92rem var(--mono); word-break: break-all; }
/* The address a private hop's name resolves to. Deliberately quieter than
   .ip -- it is a corroboration, not the observed address. */
.hop-head .via {
  font: .82rem var(--mono); color: var(--accent); word-break: break-all;
}
.hop-head .delta {
  margin-left: auto; font: .8rem var(--mono); color: var(--muted);
}
/* A relay stamped earlier than the one before it. Clock drift usually, so it
   is coloured as a caution and not as a failure. */
.hop-head .delta.backwards { color: var(--warn); font-weight: 600; }

.hop-body {
  margin: .25rem 0 0; font-size: .84rem; color: var(--fg);
}
.hop-body > div { padding: .05rem 0; word-break: break-word; }
.hop-body .k {
  display: inline-block; min-width: 7.5rem;
  color: var(--muted); font-size: .74rem;
  letter-spacing: .06em; text-transform: uppercase;
}

@media (max-width: 34rem) {
  .hop-body .k { min-width: 0; margin-right: .4rem; }
  .hop-head .delta { margin-left: 0; }
}

.examples { margin: .7rem 0 0; color: var(--muted); font-size: .85rem; }
.examples a { color: var(--muted); }

/* ---- panels ---------------------------------------------------------- */

section.card {
  margin: 1.5rem 0 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
section.card > h2,
details.card > summary {
  margin: 0; padding: .8rem 1rem;
  font-size: .78rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
/* The disclosure card, used for "From a terminal" on the front page.
   <details> rather than a script, because the vhost's CSP is
   `default-src 'none'` with no script-src at all -- there is no JavaScript on
   this site. The element does this natively, keeps the content in the DOM for
   find-in-page and for a crawler, and needs no state anywhere. */
details.card {
  margin: 1.5rem 0 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
details.card > summary {
  cursor: pointer;
  list-style: none;          /* Firefox */
  user-select: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary:hover { color: var(--fg); }
details.card:focus-within > summary { color: var(--fg); }

/* A chevron drawn from two borders rather than a glyph, so it does not depend
   on which arrows the visitor's font happens to carry. It is a flex item
   because the shared summary/h2 rule above sets display:flex. */
details.card > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: .45rem; height: .45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
details.card[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}

/* Closed, the summary IS the whole card, and a bottom border under it reads
   as a rule to nowhere. */
details.card:not([open]) > summary { border-bottom: 0; }

section.card > h2 .why {
  text-transform: none; letter-spacing: 0; font-weight: 400;
  color: var(--muted); font-size: .85rem;
}
.card .body { padding: 1rem; }
.card .body > p:first-child { margin-top: 0; }
.card .body > p:last-child { margin-bottom: 0; }

/* ---- tables ---------------------------------------------------------- */

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td {
  text-align: left; padding: .55rem .75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.rec, td.ns, td.serial { font-family: var(--mono); font-size: .86rem; }
td.rec { word-break: break-all; }
td.ttl, td.ms { color: var(--muted); font-family: var(--mono);
                font-size: .82rem; white-space: nowrap; text-align: right; }
tr.disagrees td { background: var(--fail-bg); }

/* ---- status pills ---------------------------------------------------- */

.pill {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font: 700 .7rem/1.6 var(--sans); letter-spacing: .05em;
  text-transform: uppercase; white-space: nowrap;
}
.pill.ok      { color: var(--ok);   background: var(--ok-bg); }
.pill.warn    { color: var(--warn); background: var(--warn-bg); }
.pill.fail,
.pill.bogus   { color: var(--fail); background: var(--fail-bg); }
.pill.none,
.pill.insecure,
.pill.unknown { color: var(--none); background: var(--none-bg); }
.pill.secure  { color: var(--magic); background: var(--none-bg); }

/* ---- record blocks --------------------------------------------------- */

.rr {
  font-family: var(--mono); font-size: .86rem;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: .5rem .65rem; margin: .3rem 0 0;
  word-break: break-all; white-space: pre-wrap;
}
.note {
  color: var(--warn); font-size: .82rem; margin: .3rem 0 0;
}
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

/* The SPF expansion tree. Depth is the whole point of the panel, so it is
   drawn with a real indent and a rule rather than with nested lists, which
   collapse to nothing on a phone. */
.tree { margin: 0; padding: 0; list-style: none; font-family: var(--mono);
        font-size: .84rem; }
.tree li { padding: .35rem 0 .35rem .9rem; border-left: 2px solid var(--line); }
.tree li .dom { color: var(--accent); font-weight: 600; }

/* ---- verdict banner -------------------------------------------------- */

.verdict {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .8rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  margin: 1.5rem 0 0; font-size: .92rem;
}
.verdict.ok   { border-color: var(--ok);   background: var(--ok-bg); }
.verdict.warn { border-color: var(--warn); background: var(--warn-bg); }
.verdict.fail { border-color: var(--fail); background: var(--fail-bg); }
.verdict b { display: block; }

.error {
  margin: 1.25rem 0 0; padding: .85rem 1rem;
  border: 1px solid var(--fail); background: var(--fail-bg);
  color: var(--fail); border-radius: var(--radius); font-size: .92rem;
}

/* ---- footer ---------------------------------------------------------- */

footer.site {
  margin: 3rem 0 0; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .85rem;
}
footer.site a { color: var(--accent); }

a { color: var(--accent); }

/* ---- prose ----------------------------------------------------------- */

.prose { max-width: 42rem; }
.prose h2 { font-size: 1.05rem; margin: 2rem 0 .5rem; }
.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--panel-2); padding: .1rem .3rem; border-radius: 4px;
}
.prose pre {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem 1rem; overflow-x: auto;
  font-family: var(--mono); font-size: .84rem;
}

@media (max-width: 34rem) {
  header.site img { width: 72px; height: 72px; }
  header.site nav { width: 100%; margin: .5rem 0 0; }
  form.ask button { flex: 1 1 100%; }
}
