/* DNSTuner. The chrome is ink on paper; color is used only to say pass, warning or problem. */

@font-face {
    font-family: "Atkinson Next";
    src: url(../fonts/atkinson-next.woff2) format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Mono";
    src: url(../fonts/atkinson-mono.woff2) format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

:root {
    color-scheme: light dark;
    --paper: light-dark(#f2f4f6, #0e1419);
    --surface: light-dark(#ffffff, #161e26);
    --sunken: light-dark(#e8ecf0, #0a0f13);
    --ink: light-dark(#16212c, #e4eaf0);
    --muted: light-dark(#556270, #93a1af);
    --line: light-dark(#d3d9df, #2a3642);
    --pass: light-dark(#17794a, #4fc28b);
    --pass-bg: light-dark(#e2f3e9, #12301f);
    --warning: light-dark(#a35500, #edb04a);
    --warning-bg: light-dark(#fdf0d8, #382a0d);
    --fail: light-dark(#be2a1f, #ff7466);
    --fail-bg: light-dark(#fce6e3, #3b1714);
    --focus: light-dark(#3451d1, #8fa4ff);
    --sans: "Atkinson Next", system-ui, sans-serif;
    --mono: "Atkinson Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --badge: 6.25rem;
}

/* The header button stores a choice; without one the system setting applies. */
:root.dark { color-scheme: dark; }
:root.light { color-scheme: light; }

.is-pass { --tone: var(--pass); --tone-bg: var(--pass-bg); }
.is-warning { --tone: var(--warning); --tone-bg: var(--warning-bg); }
.is-fail { --tone: var(--fail); --tone-bg: var(--fail-bg); }
.is-info { --tone: var(--muted); --tone-bg: var(--sunken); }

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font: 1rem/1.55 var(--sans);
    -webkit-text-size-adjust: 100%;
}

.wrap {
    width: 100%;
    max-width: 60rem;
    margin-inline: auto;
    padding-inline: 1.25rem;
}

main { flex: 1; padding-block: 2rem 4rem; }

h1, h2, h3, p, ul, dl, dd { margin: 0; }

h1 {
    font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem);
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

h2 {
    font-size: 1.375rem;
    line-height: 1.25;
    font-weight: 700;
    margin-block: 2.75rem 0.875rem;
}

h3 { font-size: 1rem; font-weight: 650; }

a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 0.18em;
}

a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

code, pre, .mono, .domain { font-family: var(--mono); }
code { font-size: 0.9375em; }

.quiet { color: var(--muted); font-weight: 400; }
.small { font-size: 0.875rem; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 62ch; margin-top: 0.875rem; }
.crumb { font-size: 0.9375rem; margin-bottom: 1rem; }
.domain { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999rem; }
.clipboard-source { position: fixed; left: -999rem; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 1; padding: 0.5rem 0.75rem; background: var(--surface); }

/* Header and footer */

.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 3.5rem; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
    font-weight: 750;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.brand svg { width: 1.125rem; height: 1.125rem; fill: currentColor; }

.site-head nav { display: flex; gap: 1.125rem; }
.site-head nav a { color: var(--muted); font-weight: 600; font-size: 0.9375rem; text-decoration: none; }
.site-head nav a:hover { color: var(--ink); }

.site-head nav a[aria-current] {
    color: var(--ink);
    text-decoration: underline 2px;
    text-underline-offset: 0.45em;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.icon-btn:hover { color: var(--ink); background: var(--paper); }
.icon-btn svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }

.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.25rem; }

/* Buttons and forms */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--ink);
    font: 600 0.9375rem/1.3 var(--sans);
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--line); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { opacity: 0.88; }
.btn-small { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }

/* The request indicator of "Check again" */
.btn.htmx-request::after {
    content: "";
    width: 0.8em;
    height: 0.8em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(1turn); } }

.ask { margin-top: 1.75rem; max-width: 40rem; }
.ask label { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.375rem; }
.ask-row { display: flex; gap: 0.5rem; }

.ask input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--ink);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--ink);
    font: 1.125rem/1.3 var(--mono);
}

.ask input::placeholder { color: var(--muted); opacity: 0.7; }
.ask .btn { padding-inline: 1.25rem; font-size: 1rem; }
.ask-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }

/* Home */

.hero { padding-block: 2rem 1rem; }
.hero h1 { max-width: 20ch; }

.topics { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 2.5rem; }
.topics > div { padding-block: 0.75rem; border-top: 1px solid var(--line); }
.topics dt { font-weight: 650; }
.topics dd { color: var(--muted); }

/* Report head: verdict and grade */

summary { cursor: pointer; }

.report-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}
.report-text { min-width: 0; }
.report-head h1 { margin-bottom: 0.5rem; }
.report-head .fix-link { margin-top: 0.75rem; }
.grade-help, .other-domain, .check-overview { margin-top: 0.875rem; }
.grade-help summary, .other-domain summary, .check-overview summary { width: fit-content; font-size: 0.9375rem; }
.grade-help p { margin-top: 0.5rem; }
.other-domain .ask { margin-block: 0.75rem; }
.check-overview { padding-top: 0.875rem; border-top: 1px solid var(--line); }
.check-overview summary { font-weight: 650; }
.check-overview .strip { margin-top: 0.75rem; }

.verdict-line { font-size: 1.25rem; font-weight: 650; margin-top: 0.375rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block: 1rem 0.625rem; }

.grade {
    flex: none;
    display: grid;
    place-content: center;
    justify-items: center;
    width: 6rem;
    height: 6rem;
    border: 2px solid var(--tone);
    border-radius: 0.875rem;
    background: var(--tone-bg);
    color: var(--tone);
}

.grade-letter { font-size: 2.5rem; line-height: 1; font-weight: 750; }
.grade-label { font-size: 0.8125rem; font-weight: 600; margin-top: 0.25rem; }
.grade-small { width: 3.5rem; height: 3.5rem; border-radius: 0.625rem; }
.grade-small .grade-letter { font-size: 1.5rem; }

/* The strip: one bar per check, grouped by category. Height and color both carry the status. */

.strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.875rem 1.25rem;
    margin-block: 1.5rem 0.5rem;
    padding: 1rem 1.125rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    background: var(--surface);
}

.ticks { display: flex; align-items: flex-end; gap: 3px; height: 2rem; }
.tick { width: 7px; height: 0.75rem; border-radius: 2px; background: var(--tone); }
.tick.is-info { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.tick.is-warning { height: 1.375rem; }
.tick.is-fail { height: 2rem; }
.tick:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.strip-label { display: block; margin-top: 0.375rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-decoration: none; }
.strip-label:hover { color: var(--ink); }

.loading { margin-top: 1.75rem; }
.loading.htmx-request .load-direct { display: none; }

.bars-loading {
    height: 0.75rem;
    max-width: 30rem;
    margin-top: 1.25rem;
    background: repeating-linear-gradient(90deg, var(--muted) 0 7px, transparent 7px 10px);
    -webkit-mask: linear-gradient(90deg, #000 40%, #0003 50%, #000 60%) 100% 0 / 300% 100%;
    mask: linear-gradient(90deg, #000 40%, #0003 50%, #000 60%) 100% 0 / 300% 100%;
    animation: sweep 1.4s linear infinite;
}

@keyframes sweep { to { -webkit-mask-position: 0 0; mask-position: 0 0; } }

/* Status word with icon */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--tone);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.5rem;
    white-space: nowrap;
}

.ico { flex: none; width: 1em; height: 1em; }

/* Lists of checks: the to-do lists and the rows of a category share one grid */

.advice-list, .rows, .details, .records { list-style: none; padding: 0; }

.advice, .row {
    display: grid;
    grid-template-columns: var(--badge) minmax(0, 1fr);
    align-items: start;
    gap: 0.25rem 1rem;
    padding: 0.875rem 1.25rem;
    scroll-margin-top: 1rem;
}

.advice {
    margin-bottom: 0.625rem;
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    background: var(--surface);
}

.advice:target, .row:target { outline: 2px solid var(--focus); outline-offset: -2px; }

.row-body > * + * { margin-top: 0.375rem; }
.row-body > a { display: inline-block; font-size: 0.875rem; }
.row-body h3 .quiet { font-size: 0.875rem; margin-left: 0.375rem; }
.row p { font-size: 0.9375rem; }
.row.is-pass p { color: var(--muted); }

.details, .record pre {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: var(--sunken);
    font: 0.8125rem/1.6 var(--mono);
    overflow-wrap: anywhere;
}

.record { display: flex; align-items: flex-start; gap: 0.5rem; }
.record pre { flex: 1; min-width: 0; margin: 0; white-space: pre-wrap; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }

.cat {
    margin-bottom: 0.625rem;
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    background: var(--surface);
    scroll-margin-top: 1rem;
}

.cat summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0 1rem;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    list-style: none;
}

.cat summary::-webkit-details-marker { display: none; }
.cat-name { font-size: 1.0625rem; font-weight: 700; }

.cat-name::before {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-right: 0.625rem;
    border: solid var(--muted);
    border-width: 0 2px 2px 0;
    transform: translateY(-0.2em) rotate(-45deg);
}

.cat[open] .cat-name::before { transform: translateY(-0.3em) rotate(45deg); }
.cat-tally { color: var(--tone, var(--muted)); font-size: 0.875rem; font-weight: 650; text-align: right; }
.cat-desc { grid-column: 1 / -1; color: var(--muted); font-size: 0.9375rem; }
.cat .rows, .cat .table-wrap { border-top: 1px solid var(--line); }
.cat .table-wrap { border-width: 1px 0 0; border-radius: 0; }
.row + .row { border-top: 1px solid var(--line); }

/* Messages */

.notice {
    margin-block: 1.25rem;
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--tone);
    border-radius: 0.5rem;
    background: var(--tone-bg);
}

/* Propagation and comparison */

.mobile-label { display: none; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 1.5rem; }

.tabs a {
    padding: 0.3125rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.375rem;
    background: var(--surface);
    font: 600 0.875rem/1.4 var(--mono);
    text-decoration: none;
}

.tabs a:hover { border-color: var(--ink); }
.tabs a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0.625rem; background: var(--surface); }
table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; }
thead th { color: var(--muted); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--line); }
tbody th { font-weight: 650; }
tbody th .quiet { display: block; font-size: 0.8125rem; }
td p { font-size: 0.875rem; color: var(--muted); }
td.mono, .records { font-size: 0.8125rem; white-space: nowrap; }
.records { font-family: var(--mono); white-space: normal; overflow-wrap: anywhere; min-width: 12rem; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-block: 1.5rem; }
.pair ~ .table-wrap { margin-bottom: 0.625rem; }

.side {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 0.625rem;
    background: var(--surface);
    text-decoration: none;
}

.side:hover { border-color: var(--ink); }
.side > span:last-child { display: grid; min-width: 0; }
.side .link { font-size: 0.875rem; text-decoration: underline; color: var(--muted); }

@media (max-width: 40rem) {
    :root { --badge: 100%; }
    .advice, .row { grid-template-columns: minmax(0, 1fr); }
    .topics, .pair, .ask-pair { grid-template-columns: 1fr; }
    .ask-row { flex-direction: column; }
    .ask .btn { justify-content: center; }
    .site-head .wrap { gap: 0.75rem; }
    .site-head nav { gap: 0.875rem; }
    .report-head h1 { font-size: 1.625rem; }
    .actions .btn { padding-inline: 0.65rem; }
    .record { flex-direction: column; }
    .record pre { width: 100%; }

    .resolver-table table { min-width: 0; }
    .resolver-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .resolver-table tbody, .resolver-table table { display: block; }
    .resolver-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        padding: 0.875rem 1rem;
        gap: 0.375rem 0.75rem;
    }
    .resolver-table tr:first-child { border: 0; }
    .resolver-table th, .resolver-table td { padding: 0; overflow-wrap: anywhere; }
    .resolver-table .resolver-status { grid-area: 1 / 2; text-align: right; }
    .resolver-answer { grid-column: 1 / -1; }
    .resolver-table .records { min-width: 0; }
    .resolver-table .mobile-label { display: inline; }
    .resolver-table td.mono { color: var(--muted); }
    .grade { width: 4.5rem; height: 4.5rem; }
    .grade-letter { font-size: 1.75rem; }
    .grade-small { width: 3.5rem; height: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .bars-loading, .btn.htmx-request::after { animation: none; }
}
