/*
 * DNS Fetcher stylesheet.
 *
 * Hand-authored rather than generated: the site is a single page, so a build
 * step would cost more than it returns, and the previous cdn.tailwindcss.com
 * script compiled CSS in the browser on every page load, which its own docs
 * say not to do in production.
 */

:root {
    color-scheme: light dark;

    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-alt: #f9fafb;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-contrast: #ffffff;

    --ok: #15803d;
    --ok-bg: #dcfce7;
    --warn: #a16207;
    --warn-bg: #fef9c3;
    --fail: #b91c1c;
    --fail-bg: #fee2e2;
    --info: #1e40af;
    --info-bg: #dbeafe;

    --radius: 10px;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.04);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --surface: #1e293b;
        --surface-alt: #172033;
        --border: #334155;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --accent: #3b82f6;
        --accent-hover: #60a5fa;

        --ok: #4ade80;
        --ok-bg: #14321f;
        --warn: #fbbf24;
        --warn-bg: #362a09;
        --fail: #f87171;
        --fail-bg: #3b1414;
        --info: #93c5fd;
        --info-bg: #17233f;

        --shadow: 0 1px 3px rgb(0 0 0 / 0.4);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 62rem;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

/* ---------- layout with an ad rail ---------- */

/*
 * Single column by default. The rail only appears once the viewport can hold a
 * 300px unit beside the content without squeezing it, so the tool never
 * competes with an ad for width on a laptop or phone.
 */
.layout {
    display: block;
}

.layout-rail {
    display: none;
}

@media (min-width: 78rem) {
    .wrap {
        max-width: 78rem;
    }

    .layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 1.5rem;
        align-items: start;
    }

    .layout-rail {
        display: block;
        position: sticky;
        top: 1.5rem;
    }
}

/* ---------- ad units ---------- */

.ad {
    display: block;
    margin: 1rem 0;
    padding: 0.5rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    overflow: hidden;
}

/*
 * Reserve height per placement so the page does not jump when the iframe
 * arrives. Cumulative Layout Shift is a ranking signal, and an ad that shoves
 * the results down as the user starts reading is also the classic cause of
 * accidental clicks, which is what gets an AdSense account suspended.
 */
.ad--top,
.ad--footer {
    min-height: 100px;
}

.ad--results,
.ad--article {
    min-height: 280px;
}

.ad--rail {
    min-height: 600px;
    margin-top: 0;
}

.ad-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}

.ad .adsbygoogle {
    display: block;
    width: 100%;
}

/*
 * When AdSense has no ad to serve it marks the <ins> unfilled. Collapsing the
 * whole wrapper avoids a labelled empty box, which otherwise looks broken.
 */
.ad:has(> ins[data-ad-status="unfilled"]) {
    display: none;
}

@media (max-width: 48rem) {
    /* One horizontal unit is enough on a phone; the footer one would land on
       top of the site footer and read as part of it. */
    .ad--footer {
        display: none;
    }
}

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

.masthead {
    margin-bottom: 2rem;
}

.masthead h1 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.masthead p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
}

/* ---------- cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.card + .card {
    margin-top: 1rem;
}

.card h2 {
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ---------- tool picker ---------- */

.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tool {
    display: block;
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    cursor: pointer;
    background: var(--surface-alt);
    transition: border-color 0.15s, background 0.15s;
}

.tool:hover {
    border-color: var(--accent);
}

.tool input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tool-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
}

.tool-desc {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tool:has(input:checked) {
    border-color: var(--accent);
    background: var(--info-bg);
}

.tool:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- form controls ---------- */

.query {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: flex-end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field--grow {
    flex: 1 1 18rem;
}

.field label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

button[type="submit"] {
    padding: 0.6rem 1.4rem;
    font: inherit;
    font-weight: 600;
    color: var(--accent-contrast);
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

button[type="submit"]:hover:not(:disabled) {
    background: var(--accent-hover);
}

button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: progress;
}

.hidden {
    display: none !important;
}

/* ---------- results ---------- */

/*
 * #results holds its own .card, but it is a sibling of the form rather than of
 * the cards inside it, so the `.card + .card` rule never applied to it and the
 * answer appeared flush against the Target box. Separated by more than the gap
 * between the form's own cards, because this is a different region of the page:
 * input above, output below.
 */
#results {
    margin-top: 1.75rem;
}

.summary {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.summary p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.timing {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge--ok { color: var(--ok); background: var(--ok-bg); }
.badge--warn { color: var(--warn); background: var(--warn-bg); }
.badge--fail { color: var(--fail); background: var(--fail-bg); }
.badge--info { color: var(--info); background: var(--info-bg); }

.section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 1rem;
}

.section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.section h3 {
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.note {
    margin: 0.6rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Tables scroll inside their own box so the page never scrolls sideways. */
.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th,
td {
    text-align: left;
    padding: 0.4rem 0.7rem 0.4rem 0;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}

td {
    font-family: var(--mono);
    font-size: 0.85rem;
    word-break: break-word;
}

tr:last-child td {
    border-bottom: 0;
}

dl {
    display: grid;
    grid-template-columns: minmax(8rem, auto) 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

dt {
    color: var(--text-muted);
}

dd {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.85rem;
    word-break: break-word;
}

.findings {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.finding {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    flex-wrap: wrap;
    font-size: 0.88rem;
}

.finding-label {
    font-weight: 600;
    min-width: 9rem;
}

.finding-detail {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 0.82rem;
    word-break: break-word;
}

ul.bullets {
    margin: 0;
    padding-left: 1.1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
}

ul.bullets li {
    word-break: break-word;
}

pre {
    margin: 0;
    padding: 0.8rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

details summary {
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

details[open] summary {
    margin-bottom: 0.6rem;
}

.error {
    color: var(--fail);
    background: var(--fail-bg);
    border: 1px solid currentColor;
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    font-size: 0.92rem;
}

.spinner {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -0.1em;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 3s; }
    * { transition-duration: 0.01ms !important; }
}

/* ---------- legal pages ---------- */

/*
 * privacy-policy.php is now hand-written semantic HTML, so these are ordinary
 * typography rules.
 *
 * They replace a block of `.legal * { color: ... !important }` overrides that
 * existed only to fight the inline styles baked into the generated document it
 * used to contain. That block also carried `font-size: inherit !important`,
 * which would flatten every heading in the rewritten policy — the overrides had
 * to go with the markup that made them necessary.
 */

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.masthead h1 a {
    color: inherit;
    text-decoration: none;
}

.legal {
    line-height: 1.7;
    overflow-wrap: break-word;
    font-size: 0.95rem;
}

.legal a {
    color: var(--accent);
    text-decoration: underline;
}

/*
 * The document title. The article is a .card, so the uppercase muted `.card h2`
 * rule applies to it; that selector scores 0,1,1, so a lone .legal-title class
 * loses to it. Qualifying with the ancestor takes the count to 0,2,0 and wins.
 */
.legal .legal-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--text);
}

.legal-updated {
    margin: 0.15rem 0 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legal h3 {
    margin: 2.25rem 0 0.6rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.legal h4 {
    margin: 1.5rem 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* In-page contents links land below the top edge rather than flush against it. */
.legal :is(h3, h4)[id] {
    scroll-margin-top: 1rem;
}

.legal p {
    margin: 0 0 0.85rem;
}

.legal ul,
.legal ol {
    margin: 0 0 0.85rem;
    padding-left: 1.4rem;
}

.legal li {
    margin-bottom: 0.4rem;
}

/*
 * The two boxes at the top: a plain-language summary and the contents. Both are
 * navigation aids rather than terms, so they are set apart from the body.
 */
.legal-summary,
.legal-toc {
    margin: 0 0 1.5rem;
    padding: 1rem 1.15rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.legal-summary h3,
.legal-toc h3 {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.legal-summary > ul:last-child,
.legal-summary > p:last-child,
.legal-toc ol:last-child {
    margin-bottom: 0;
}

.legal-toc ol {
    columns: 2;
    column-gap: 1.5rem;
    font-size: 0.88rem;
}

.legal-toc li {
    /* Keep a wrapped entry from splitting across the two columns. */
    break-inside: avoid;
    margin-bottom: 0.25rem;
}

@media (max-width: 40rem) {
    .legal-toc ol {
        columns: 1;
    }
}

/* Hostnames, cookie names and header values quoted inside prose. */
.legal-code {
    font-family: var(--mono);
    font-size: 0.86em;
    word-break: break-word;
}

/*
 * Tables here carry sentences, not lookup output, so the monospace and nowrap
 * rules that suit a DNS answer are undone.
 */
.legal table {
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

.legal :is(th, td) {
    padding: 0.5rem 0.9rem 0.5rem 0;
    line-height: 1.55;
}

.legal td {
    font-family: inherit;
    font-size: inherit;
    word-break: normal;
}

.legal th {
    white-space: normal;
}

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

.site-footer {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--accent);
}

@media (max-width: 30rem) {
    dl {
        grid-template-columns: 1fr;
        gap: 0.1rem 0;
    }

    dt {
        margin-top: 0.5rem;
    }

    .finding-label {
        min-width: 0;
    }
}
