/*
 * Domain Toolkit UI.
 *
 * The CSP forbids inline styles (script-src/style-src 'self', no
 * 'unsafe-inline'), so every value the server needs to vary — progress
 * width, SPF meter fill — is a class defined here, never a style
 * attribute.
 *
 * Lato and IBM Plex Mono are self-hosted; the @font-face rules live in
 * assets/fonts/fonts.css, generated by scripts/fetch-fonts.php. Lato's
 * 900 carries the headings and no system face substitutes for it, so
 * the fallbacks below are a safety net, not a plan.
 */

:root {
    --bg: #f1f3f6;
    --surface: #ffffff;
    --surface-sunken: #fbfcfd;
    --surface-inset: #f4f6f9;
    --text: #1b2430;
    --text-soft: #4a5666;
    --text-muted: #6b7684;
    --text-faint: #8b96a3;
    --text-fainter: #9aa4b0;
    --border: #e2e7ec;
    --border-soft: #f2f4f7;
    --border-strong: #d8dee5;

    --accent: #0b6bcb;
    --accent-strong: #054e99;
    --error: #c0392b;
    --warning: #b7791f;
    --info: #2f6fd0;
    --ok: #178a5a;
    --error-soft: #fdecea;
    --warning-soft: #fdf3e3;
    --info-soft: #eef4fd;
    --ok-soft: #e7f5ee;

    --radius-lg: 14px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgb(20 38 60 / 0.04);
    --shadow-hero: 0 10px 30px -18px rgb(20 38 60 / 0.45), 0 1px 2px rgb(20 38 60 / 0.06);

    --font-sans: Lato, "Helvetica Neue", Helvetica, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141d;
        --surface: #171e2a;
        --surface-sunken: #1c2430;
        --surface-inset: #202936;
        --text: #e7ebf1;
        --text-soft: #c2cad6;
        --text-muted: #9aa4b2;
        --text-faint: #8790a0;
        --text-fainter: #79828f;
        --border: #2a3441;
        --border-soft: #232c38;
        --border-strong: #35404e;

        --accent: #5aa2f0;
        --accent-strong: #8bc0ff;
        --error: #f0776a;
        --warning: #e0a84a;
        --info: #6ea8f0;
        --ok: #4fbd8a;
        --error-soft: #3a2220;
        --warning-soft: #35291a;
        --info-soft: #1e2a3d;
        --ok-soft: #172f27;

        --shadow-card: 0 1px 2px rgb(0 0 0 / 0.35);
        --shadow-hero: 0 10px 30px -18px rgb(0 0 0 / 0.7), 0 1px 2px rgb(0 0 0 / 0.4);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

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

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    min-height: 56px; padding: 8px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); text-decoration: none;
}

.brand:hover { color: var(--text); text-decoration: none; }

.brand-mark {
    width: 26px; height: 26px; border-radius: var(--radius-sm);
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex: none;
}

.brand-dot {
    width: 9px; height: 9px; border-radius: 50%;
    border: 2.5px solid #ffffff;
}

.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.1px; }

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

.quicksearch {
    display: flex; align-items: center; gap: 8px;
    margin-left: auto; flex: 1; min-width: 0; max-width: 420px;
}

.quicksearch-field {
    display: flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 12px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex: 1; min-width: 0;
}

.quicksearch-field:focus-within { border-color: var(--accent); }
.quicksearch-hint { color: var(--text-faint); font-size: 13px; flex: none; }

.quicksearch input {
    flex: 1; min-width: 0;
    border: none; background: transparent;
    font: 500 13.5px/1 var(--font-mono);
    color: var(--text);
}

.quicksearch input:focus { outline: none; }

.quicksearch button {
    display: flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--accent); border-radius: var(--radius-sm);
    background: var(--accent); color: #ffffff;
    font: 700 13px var(--font-sans);
    cursor: pointer; flex: none; white-space: nowrap;
}

.quicksearch button:hover { filter: brightness(1.08); }
.quicksearch button:disabled { opacity: 0.75; cursor: progress; }

.button-spinner {
    width: 13px; height: 13px;
    border: 2px solid rgb(255 255 255 / 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ---- landing ---- */

.page { flex: 1; width: 100%; }

.landing {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 24px 120px; text-align: center;
}

.landing-title { margin: 0 0 10px; font-size: 34px; font-weight: 900; letter-spacing: -0.8px; }

.landing-lede {
    margin: 0 0 30px; max-width: 460px;
    font-size: 15px; line-height: 1.55; color: var(--text-muted);
    text-wrap: pretty;
}

.herosearch {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    width: 100%; max-width: 560px;
    padding: 8px 8px 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hero);
}

.herosearch-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }

.herosearch input {
    flex: 1; min-width: 0; padding: 10px 0;
    border: none; background: transparent;
    font: 500 19px/1.2 var(--font-mono);
    color: var(--text);
}

.herosearch input:focus { outline: none; }

.herosearch button {
    display: flex; align-items: center; gap: 8px;
    height: 46px; padding: 0 22px;
    border: none; border-radius: 10px;
    background: var(--accent); color: #ffffff;
    font: 700 15px var(--font-sans);
    cursor: pointer; flex: none;
}

.herosearch button:hover { filter: brightness(1.08); }
.herosearch button:disabled { opacity: 0.75; cursor: progress; }

.landing-examples {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px;
    margin: 18px 0 0;
}

.landing-examples-label { font-size: 12.5px; color: var(--text-faint); }

.example-chip {
    height: 28px; padding: 0 12px;
    display: inline-flex; align-items: center;
    border: 1px solid var(--border); border-radius: 99px;
    background: var(--surface);
    font: 500 12.5px var(--font-mono);
    color: var(--text-soft);
}

.example-chip:hover { color: var(--accent); text-decoration: none; border-color: var(--accent); }

.landing-facts {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 22px;
    margin: 56px 0 0; padding: 0; max-width: 720px; list-style: none;
}

.landing-facts li { font-size: 12px; color: var(--text-fainter); letter-spacing: 0.02em; }

/* ---- report shell ---- */

.page-landing { display: flex; flex-direction: column; justify-content: center; }

.page-report {
    max-width: 1240px; margin: 0 auto; padding: 20px 20px 80px;
}

.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    display: flex; flex-wrap: wrap; gap: 18px;
}

.summary-domain { flex: 1; min-width: 260px; }

.eyebrow {
    margin: 0 0 8px;
    font: 500 11px/1 var(--font-mono);
    letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--text-fainter);
}

.domain-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.domain-name {
    margin: 0;
    font-size: 30px; font-weight: 900; letter-spacing: -0.7px; line-height: 1.1;
    overflow-wrap: anywhere;
}

.domain-punycode { margin: 6px 0 0; font: 400 12.5px var(--font-mono); color: var(--text-faint); }
.domain-sub { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); min-height: 1.2em; }

.counters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(74px, 100%), 1fr));
    gap: 8px; flex: 1 1 100%; min-width: 0; width: 100%;
}

.counter {
    min-width: 0; padding: 10px 12px;
    border: 1px solid var(--border-soft); border-radius: 10px;
    background: var(--surface-sunken);
    overflow: hidden;
}

.counter-value { display: block; font-size: 20px; font-weight: 900; }
.counter-error .counter-value { color: var(--error); }
.counter-warning .counter-value { color: var(--warning); }
.counter-info .counter-value { color: var(--info); }
.counter-ok .counter-value { color: var(--ok); }
.counter-label { display: block; font-size: 11px; color: var(--text-faint); letter-spacing: 0.03em; }

.progress-row { display: flex; align-items: center; gap: 12px; flex: 1 1 100%; }

.progress-track {
    flex: 1; height: 4px; border-radius: 99px;
    background: var(--border-soft); overflow: hidden;
}

.progress-fill {
    width: 0; height: 100%;
    background: var(--accent); border-radius: 99px;
    transition: width 0.45s ease;
}

.progress-fill.is-complete { width: 100%; }
.progress-status { font: 500 12px var(--font-mono); color: var(--text-muted); flex: none; }

/* ---- card grid ---- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
    gap: 16px; align-items: start;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.card-wide { grid-column: 1 / -1; }

.card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-soft);
}

.card-title { flex: 1; margin: 0; font-size: 14px; font-weight: 700; }
.card-meta { font: 500 11.5px var(--font-mono); color: var(--text-faint); }
.card-body > *:first-child { margin-top: 0; }
.card:not(.card-waiting) .card-body { animation: cardIn 0.35s ease-out both; }

.pending {
    display: flex; align-items: center; gap: 6px;
    font: 500 11.5px var(--font-mono); color: var(--text-fainter);
}

.spinner {
    width: 11px; height: 11px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.skeleton { padding: 16px; display: flex; flex-direction: column; gap: 9px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton-bar { height: 10px; border-radius: 4px; background: var(--border-soft); }
.skeleton-bar-a { width: 82%; }
.skeleton-bar-b { width: 64%; }
.skeleton-bar-c { width: 47%; }

/* ---- chain card (details/summary: opens without JS) ---- */

.card-chain > .card-head { cursor: pointer; list-style: none; }
.card-chain > .card-head::-webkit-details-marker { display: none; }

.chain-toggle {
    padding: 5px 12px;
    border: 1px solid var(--border); border-radius: 7px;
    background: var(--surface);
    font: 700 12px var(--font-sans); color: var(--accent);
}

.chain-toggle::after { content: "Visa"; }
.card-chain[open] .chain-toggle::after { content: "Dölj"; }

/* ---- pills, chips, badges ---- */

.pill {
    padding: 3px 9px; border-radius: 99px;
    font: 700 10.5px var(--font-sans);
    letter-spacing: 0.06em; text-transform: uppercase;
    white-space: nowrap;
}

.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-error { background: var(--error-soft); color: var(--error); }
.pill-brand { background: var(--info-soft); color: var(--info); }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 16px 0; }

.chip {
    padding: 4px 10px; border-radius: 6px;
    background: var(--surface-inset);
    font: 500 12px var(--font-mono); color: var(--text-soft);
}

.chip-muted { color: var(--text-fainter); }

.badge {
    flex: none;
    padding: 2px 7px; border-radius: 5px;
    font: 700 10px var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }

/* ---- card content blocks ---- */

.fieldgrid {
    padding: 14px 16px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px;
}

.field-label { font-size: 11px; color: var(--text-fainter); letter-spacing: 0.04em; margin-bottom: 3px; }
.field-value { font: 500 13px var(--font-mono); overflow-wrap: anywhere; }

.recordblock {
    margin: 0;
    padding: 14px 16px;
    background: var(--surface-sunken);
    border-bottom: 1px solid var(--border-soft);
    font: 400 12px/1.6 var(--font-mono);
    color: var(--text);
    overflow-wrap: anywhere;
}

.mx-list { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; }
.mx-target { font-size: 12.5px; color: var(--text-soft); overflow-wrap: anywhere; }
.mx-pref { color: var(--text-fainter); margin-right: 6px; }

.meter-row { display: flex; align-items: center; gap: 10px; padding: 13px 16px; }
.meter { flex: 1; height: 6px; border-radius: 99px; background: var(--border-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--warning); }
.meter-value { font: 500 12px var(--font-mono); color: var(--warning); flex: none; }
.meter-over .meter-fill { background: var(--error); }

.meter-fill-0 { width: 0; }
.meter-fill-1 { width: 10%; }
.meter-fill-2 { width: 20%; }
.meter-fill-3 { width: 30%; }
.meter-fill-4 { width: 40%; }
.meter-fill-5 { width: 50%; }
.meter-fill-6 { width: 60%; }
.meter-fill-7 { width: 70%; }
.meter-fill-8 { width: 80%; }
.meter-fill-9 { width: 90%; }
.meter-fill-10 { width: 100%; }

.card-note {
    margin: 0; padding: 12px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px; color: var(--text-soft);
    text-wrap: pretty;
}

.card-body > .card-note:first-child { border-top: none; }
.card-note-detail { color: var(--text-faint); }

/* ---- findings ---- */

.findings {
    list-style: none; margin: 0;
    padding: 12px 16px; display: flex; flex-direction: column; gap: 9px;
    border-top: 1px solid var(--border-soft);
}

.card-body > .findings:first-child { border-top: none; }

.finding { display: flex; gap: 9px; align-items: baseline; }
.finding-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.finding-message { font-size: 12.5px; color: var(--text-soft); text-wrap: pretty; }
.finding-detail { font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; }
.finding-code { font: 400 10.5px var(--font-mono); color: var(--text-fainter); }

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

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: left; white-space: nowrap;
    padding: 8px 16px;
    background: var(--surface-sunken);
    font: 500 10.5px var(--font-mono);
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-fainter);
}

tbody td {
    padding: 9px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    vertical-align: top;
    /* Break inside a token only when it genuinely does not fit — never
       the per-character shredding word-break: break-all produces once a
       column gets narrow. The column min-widths below are what keep it
       from ever getting that narrow. */
    overflow-wrap: anywhere;
}

.mono { font-family: var(--font-mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-soft); }
.rdata { overflow-wrap: anywhere; }

/* Column floors. A phone cannot show these tables at full width, so
   they scroll sideways inside .table-wrap; the floors decide how wide
   "readable" is, rather than letting the viewport squeeze columns into
   a single character per line. Values include the cell padding
   (box-sizing: border-box) and are sized for 12.5px monospace. */
.col-ttl { width: 74px; min-width: 74px; }
.col-type { width: 76px; min-width: 76px; }
.col-n { width: 60px; min-width: 60px; }
.col-rtt { width: 92px; min-width: 92px; }
.col-name { min-width: 180px; }
.col-data { min-width: 240px; }
.col-ns { min-width: 200px; }
.col-addr { min-width: 180px; }
.col-serial { min-width: 140px; }
.col-src { min-width: 96px; }
.col-ptr { min-width: 300px; }
.col-country { min-width: 84px; }
.col-net { min-width: 240px; }
.col-server { min-width: 160px; }
.col-query { min-width: 300px; }
.col-rcode { min-width: 110px; }
.col-note { min-width: 190px; }

.rrtype { color: var(--accent); font: 500 12px var(--font-mono); }

.serial-current { color: var(--ok); }
.serial-lagging { color: var(--warning); font-weight: 700; }
.serial-missing { color: var(--text-fainter); }

.rcode-ok { color: var(--ok); }
.rcode-other { color: var(--warning); }
.trace-failed td { color: var(--error); }

/* Below these widths the table scrolls inside its card rather than
   stretching the grid column. The column floors above usually decide
   the real minimum; these keep short-content tables from collapsing. */
.rr-table { min-width: 570px; }
.svc-table { min-width: 556px; }
.ns-table { min-width: 540px; }
.rdns-table { min-width: 900px; }
.chain-table { min-width: 920px; }

.fcrdns { margin-left: 4px; }
.fcrdns-ok { color: var(--ok); }
.fcrdns-bad { color: var(--warning); }
.country { font: 500 12.5px var(--font-mono); color: var(--ok); }
.reg-country { color: var(--text-fainter); white-space: nowrap; }

.table-note {
    margin: 0; padding: 12px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px; color: var(--text-faint);
    text-wrap: pretty;
}

/* ---- footer & errors ---- */

.site-footer {
    display: flex; flex-wrap: wrap; gap: 14px;
    max-width: 1240px; margin: 0 auto; padding: 0 20px 40px;
    font-size: 12.5px; color: var(--text-faint);
}

.error-card { margin-bottom: 16px; }
.stream-error { margin-bottom: 16px; }

@media (max-width: 640px) {
    .topbar { flex-wrap: wrap; }
    .quicksearch { max-width: none; flex-basis: 100%; }
    .landing { padding: 40px 16px 80px; }
    .landing-title { font-size: 26px; }
    .domain-name { font-size: 24px; }
    .page-report { padding: 14px 14px 60px; }
    .progress-row { flex-wrap: wrap; }
    /* Buy back horizontal room in the scrolling tables. */
    thead th, tbody td { padding-left: 11px; padding-right: 11px; }
}
