/* DMARC Tool: website and app.
 *
 * Palette: CloudCircus-neutral greys with a green accent.
 *   white on --brand-600   5.6:1 (buttons)
 *   --brand-700 on white   7.4:1 (links)
 *   --grey-600 on white    5.8:1 (muted text)
 * Status colours (pass/fail in charts) are the dataviz reference status steps and always come with
 * a label or icon. Light theme only, like the other CloudCircus sites.
 * No inline styles anywhere: the CSP is style-src 'self'.
 */

:root {
  color-scheme: light;
  --brand: #16a37b;
  --brand-600: #0f7a5c;
  --brand-700: #0b6249;
  --brand-100: #d9f2ea;
  --brand-50: #effaf6;

  --grey-600: #636569;
  --grey-300: #c9cacc;
  --grey-200: #dfe0e1;
  --grey-100: #eff0f0;
  --grey-50: #f7f7f8;

  --ink: #1f2933;
  --ink-900: #111827;
  --white: #ffffff;

  --good: #0ca30c;
  --good-ink: #0a6b0a;
  --good-bg: #e8f6e8;
  --warn: #fab219;
  --warn-ink: #7a5200;
  --warn-bg: #fff6e0;
  --bad: #d03b3b;
  --bad-ink: #a12424;
  --bad-bg: #fdecec;
  --info-ink: #1d4f91;
  --info-bg: #eaf2fc;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 29, 29, .06), 0 8px 24px rgba(31, 29, 29, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--white);
}
main { flex: 1; }
h1, h2, h3 { color: var(--ink-900); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; margin-top: 1.25rem; }
p, ul, ol { margin: 0 0 1rem; }
a { color: var(--brand-700); text-underline-offset: 2px; }
a:hover { color: var(--ink-900); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--grey-100); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--grey-50); border: 1px solid var(--grey-200); border-radius: var(--radius-sm); padding: 12px 14px;
      overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--grey-600); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 780px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

/* ── Header / footer ───────────────────────────────────── */
.site-header { border-bottom: 1px solid var(--grey-100); background: var(--white); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--ink-900); letter-spacing: -.01em; }
.brand .mark { width: 28px; height: 28px; }
.brand .accent { color: var(--brand-600); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav form { margin: 0; }
.nav-link { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); font-weight: 500; }
.nav-link:hover { background: var(--grey-50); color: var(--ink-900); }
@media (max-width: 560px) { .nav-link.hide-sm { display: none; } }

.site-footer { border-top: 1px solid var(--grey-100); margin-top: 64px; padding: 28px 0; color: var(--grey-600); font-size: .9rem; }
.footer-inner { display: flex; gap: 16px 28px; flex-wrap: wrap; justify-content: space-between; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--grey-600); }

/* ── Buttons & forms ───────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius-sm);
       border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn-primary { background: var(--brand-600); color: var(--white); }
.btn-primary:hover { background: var(--brand-700); color: var(--white); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--grey-200); }
.btn-ghost:hover { background: var(--grey-50); color: var(--ink-900); }
.btn-danger { background: var(--white); color: var(--bad-ink); border-color: #f0b4b4; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad-ink); }
.btn-small { padding: 6px 12px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand-700); font: inherit; text-decoration: underline; cursor: pointer; }

.form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--grey-300); border-radius: var(--radius-sm); background: var(--white); color: var(--ink);
}
input:focus { outline: 3px solid var(--brand-100); border-color: var(--brand-600); }
.field .help, .fine-print { font-size: .85rem; color: var(--grey-600); margin: 4px 0 0; }
.error { color: var(--bad-ink); font-size: .9rem; margin: 4px 0 0; }
.has-error input { border-color: var(--bad); }
.check { display: flex; gap: 8px; align-items: center; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field-link { margin: -6px 0 0; font-size: .9rem; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; }

/* ── Messages ──────────────────────────────────────────── */
.messages { margin-top: 16px; }
.message { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info-ink); margin: 0 0 8px; }
.message-success { background: var(--good-bg); color: var(--good-ink); }
.message-warning { background: var(--warn-bg); color: var(--warn-ink); }
.message-error { background: var(--bad-bg); color: var(--bad-ink); }

/* ── Cards ─────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.auth-page { display: flex; justify-content: center; padding: 48px 16px; }
.auth-card { width: 100%; max-width: 420px; box-shadow: var(--shadow); padding: 28px; }
.card-sub { margin-bottom: 18px; }
.card-foot { margin: 18px 0 0; text-align: center; font-size: .95rem; }
.grid-2, .grid-3 { display: grid; gap: 16px; }
.card + .grid-2, .card + .grid-3, .grid-2 + .card, .grid-3 + .card { margin-top: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ── Home ──────────────────────────────────────────────── */
.hero { background: linear-gradient(180deg, var(--brand-50), var(--white)); padding: 56px 0 40px; }
.hero h1 { max-width: 760px; }
.hero .lead { font-size: 1.15rem; color: var(--grey-600); max-width: 680px; }
.check-form { display: flex; gap: 8px; flex-wrap: wrap; max-width: 640px; margin-top: 20px; }
.check-form input { flex: 1 1 260px; font-size: 1.1rem; padding: 12px 14px; }
.check-form .btn { font-size: 1.05rem; padding: 12px 22px; }
.features { padding: 40px 0 0; }
.feature h3 { margin-top: 0; }
.feature .icon { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-100); color: var(--brand-700);
                 display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 10px; }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 20px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
                      background: var(--brand-600); color: var(--white); font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ── Status badges & findings ──────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge-ok, .badge-pass, .badge-protected { background: var(--good-bg); color: var(--good-ink); }
.badge-warn, .badge-monitoring, .badge-partial, .badge-softfail, .badge-neutral, .badge-none { background: var(--warn-bg); color: var(--warn-ink); }
.badge-error, .badge-fail, .badge-unprotected, .badge-permerror, .badge-temperror { background: var(--bad-bg); color: var(--bad-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-muted { background: var(--grey-100); color: var(--grey-600); }

.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius); margin: 20px 0; }
.verdict p { margin: 0; }
.verdict strong { display: block; font-size: 1.15rem; color: var(--ink-900); }
.verdict-protected { background: var(--good-bg); }
.verdict-partial, .verdict-monitoring { background: var(--warn-bg); }
.verdict-unprotected { background: var(--bad-bg); }
.verdict .icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
                 font-weight: 800; color: var(--white); }
.verdict-protected .icon { background: var(--good); }
.verdict-partial .icon, .verdict-monitoring .icon { background: #c98700; }
.verdict-unprotected .icon { background: var(--bad); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.findings { list-style: none; padding: 0; margin: 12px 0 0; }
.findings li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--grey-100); }
.findings li:first-child { border-top: 0; }
.findings .dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
                 font-size: .75rem; font-weight: 800; color: var(--white); margin-top: 1px; }
.dot-ok { background: var(--good); }
.dot-warn { background: #c98700; }
.dot-error { background: var(--bad); }
.dot-info { background: #4a78b5; }
.findings strong { color: var(--ink-900); }
.findings p { margin: 2px 0 0; color: var(--grey-600); font-size: .95rem; }
.record { margin: 12px 0 0; }
.tags { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .95rem; }
.tags th, .tags td { text-align: left; padding: 6px 10px 6px 0; border-top: 1px solid var(--grey-100); vertical-align: top; }
.tags th { white-space: nowrap; font-family: var(--mono); font-weight: 600; width: 1%; }

/* ── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--grey-100); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--grey-600); font-weight: 700; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.sub td { background: var(--grey-50); font-size: .88rem; }
.table tr.sub td:first-child { padding-left: 26px; }
details.source > summary { cursor: pointer; list-style: none; }
details.source > summary::-webkit-details-marker { display: none; }
details.source > summary::before { content: "▸ "; color: var(--grey-600); }
details.source[open] > summary::before { content: "▾ "; }

/* ── App ───────────────────────────────────────────────── */
.app-head { padding: 28px 0 8px; }
.app-head .crumbs { font-size: .9rem; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grey-200); margin: 16px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--grey-600); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--ink-900); border-bottom-color: var(--brand-600); }
.period { display: flex; gap: 4px; flex-wrap: wrap; }
.period a { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1px solid var(--grey-200); font-size: .9rem; }
.period a.active { background: var(--ink-900); color: var(--white); border-color: var(--ink-900); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin: 16px 0; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: .85rem; color: var(--grey-600); }
.stat .value { font-size: 1.7rem; font-weight: 750; color: var(--ink-900); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .sub { font-size: .85rem; color: var(--grey-600); }
.domain-list { list-style: none; padding: 0; margin: 0; }
.domain-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--grey-100); }
.domain-list li:first-child { border-top: 0; }
.domain-list .name { font-weight: 700; font-size: 1.05rem; }
.empty { text-align: center; padding: 32px 16px; color: var(--grey-600); }
.copy-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.copy-row code, .copy-row pre { flex: 1 1 260px; margin: 0; display: flex; align-items: center; padding: 10px 12px; font-size: .95rem; background: var(--grey-50); border: 1px solid var(--grey-200); border-radius: var(--radius-sm); }
.dns-table { width: 100%; border-collapse: collapse; }
.dns-table th { text-align: left; font-size: .85rem; color: var(--grey-600); padding: 8px 10px 4px 0; width: 90px; vertical-align: top; }
.dns-table td { padding: 6px 0; }
.danger-zone { border-color: #f0b4b4; }

/* ── Chart ─────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grey-200); stroke-width: 1; }
.chart .axis-label { fill: var(--grey-600); font-size: 11px; font-family: var(--font); }
.chart .bar-pass { fill: var(--good); }
.chart .bar-fail { fill: var(--bad); }
.chart .hit { fill: transparent; }
.chart g.day:hover .hit { fill: rgba(17, 24, 39, .05); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--ink); margin: 8px 0 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch-pass { background: var(--good); }
.swatch-fail { background: var(--bad); }
.meter { display: inline-block; width: 64px; height: 8px; vertical-align: middle; margin-left: 6px; }
.meter .track { fill: var(--grey-100); }
.meter .fill-good { fill: var(--good); }
.meter .fill-bad { fill: var(--bad); }

/* ── Test email ────────────────────────────────────────── */
.address-box { font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.35rem); font-weight: 600; background: var(--brand-50);
               border: 2px dashed var(--brand-600); border-radius: var(--radius); padding: 16px; text-align: center; overflow-wrap: anywhere; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--grey-600); margin-top: 16px; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--grey-200); border-top-color: var(--brand-600); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.headers { max-height: 360px; overflow: auto; font-size: .8rem; }

.prose h2 { margin-top: 2.2rem; }
.prose li { margin-bottom: .35rem; }
.callout { background: var(--brand-50); border-left: 4px solid var(--brand-600); padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1rem; }
.callout p:last-child { margin: 0; }

/* "How to fix" under a finding */
.findings .fix { margin-top: 10px; padding: 12px 14px; background: var(--grey-50); border: 1px solid var(--grey-200); border-radius: var(--radius-sm); }
.findings .fix p { color: var(--ink); margin: 0 0 8px; }
.findings .fix p:last-child { margin-bottom: 0; }
.findings .fix .dns-table { margin: 4px 0 8px; }
.findings .fix .copy-row code { background: var(--white); }
.fix-label { display: inline-block; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-700); margin-right: 4px; }
