/* ==========================================================================
   Email Security Checker: shared styles
   Source of truth: design-system.md. Change that file first, then this one.
   Plain CSS, no build step. Mobile-first: base styles target small screens,
   `min-width` media queries add layout for larger ones (640px, 960px).
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
/* Which theme is active (design-system.md 2). Every colour token holds its dark
   value once, inside light-dark(light, dark); the active color-scheme picks
   one. color-scheme also themes native form controls and scrollbars, so they
   always match.
   - :root[data-theme="dark"]  -> dark (the visitor chose it; assets/theme.js)
   - :root[data-theme="light"] -> light (the visitor chose it)
   - no data-theme             -> follows prefers-color-scheme ("light dark") */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }
/* Without light-dark() the page is always light (see the colour tokens below),
   so native controls and scrollbars stay light too. */
@supports not (color: light-dark(#000, #fff)) {
  :root, :root[data-theme] { color-scheme: light; }
}

/* Colour tokens, in two layers:
   1. Plain light values (just below, in the main :root block). Browsers
      without light-dark() (before Chrome/Edge 123, Firefox 120, Safari 17.5)
      stop here and get the full light theme.
   2. light-dark(LIGHT, DARK) pairs, inside @supports right after this block.
      Supporting browsers use these. Each dark value is written only here.
   Why not a plain fallback line right above each light-dark() line: these are
   custom properties, which browsers don't validate when parsing, so an old
   browser would keep the later light-dark() line, fail when it's used, and
   never fall back. The @supports test is what makes the fallback work.

   Dark: same slate neutrals and the same single blue accent, lighter for a dark
   ground. Dark contrast (on --color-bg #0F172A unless noted; full list in
   design-system.md 2): text 16.3:1, muted 12.0:1, subtle 7.0:1, links 7.0:1,
   field borders 4.6:1. Status "strong" text on its own tint is 8.2-12.9:1;
   status icons on bg and on tint are all >= 5.7:1. Pass is emerald and fail a
   cooler red in dark, so the two stay apart for red-green colour blindness
   (icon shape + label still carry it). */
:root {
  /* Neutrals + single accent (light fallback) */
  --color-bg: #FFFFFF;
  --color-surface: #F8FAFC;
  --color-surface-sunken: #F1F5F9;
  --color-text: #0F172A;
  --color-text-muted: #475569;
  --color-text-subtle: #64748B;     /* only at >= 14px */
  --color-border: #E2E8F0;          /* decorative */
  --color-border-strong: #64748B;   /* form fields, >= 3:1 */
  --color-accent: #1D4ED8;
  --color-accent-hover: #1E40AF;
  --color-accent-tint: #EFF6FF;
  --color-on-accent: #FFFFFF;
  /* Primary button fill (light fallback). Light: same as the accent. */
  --color-primary: #1D4ED8;
  --color-primary-hover: #1E40AF;
  --color-on-primary: #FFFFFF;

  /* Status (light fallback).
     warn and fail are icon/border colours (fail is also error text). Picked to
     stay apart from each other and from pass under simulated protanopia,
     deuteranopia and tritanopia (dE >= 23; design-system.md 2).
     unknown is neutral on purpose: unknown is not failure.
     info shares the accent hue. */
  --color-pass: #15803D;
  --color-pass-strong: #166534;
  --color-pass-tint: #F0FDF4;
  --color-pass-border: #86EFAC;
  --color-warn: #C77700;            /* icons only: 3.5:1 on white, never text */
  --color-warn-strong: #92400E;
  --color-warn-tint: #FFFBEB;
  --color-warn-border: #FCD34D;
  --color-fail: #AA090E;
  --color-fail-strong: #991B1B;
  --color-fail-tint: #FEF2F2;
  --color-fail-border: #FCA5A5;
  --color-unknown: #475569;
  --color-unknown-strong: #475569;
  --color-unknown-tint: #F1F5F9;
  --color-unknown-border: #CBD5E1;
  --color-info: #1D4ED8;
  --color-info-strong: #1D4ED8;
  --color-info-tint: #EFF6FF;
  --color-info-border: #BFDBFE;

  /* Typography: system stacks only. No web fonts are loaded, so none are named
     here (a named font that never loads just renders as the next one anyway). */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono",
               Consolas, "Liberation Mono", Menlo, monospace;

  /* Five sizes plus the grade letter; each step >= 1.25x the one below
     (design-system.md 3). */
  --text-sm: 0.875rem;    /* 14px: captions, help, badges, records, tables */
  --text-base: 1rem;      /* 16px: body, inputs */
  --text-lg: 1.125rem;    /* 18px: h3, finding titles, leads */
  --text-xl: clamp(1.5rem, 1.4rem + 0.4vw, 1.625rem);    /* 24-26px: h2 */
  --text-2xl: clamp(2rem, 1.55rem + 1.9vw, 2.75rem);     /* 32-44px: h1 */
  --text-grade: clamp(3.5rem, 2.8rem + 3vw, 4.5rem);
  --measure: 66ch;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  /* Shape (flat: no shadow tokens; the sticky header uses a hairline) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-pill: 999px;

  /* Layout: one width on every page so the left edge never moves */
  --container: 60rem;                    /* 960px */
  --container-tool: var(--container);    /* kept for .container--tool */
  --gutter: var(--space-4);
  --tap: 44px;               /* minimum touch target */

  /* Motion */
  --duration: 150ms;                          /* hover and colour changes */
  --duration-enter: 240ms;                    /* entrances */
  --ease: cubic-bezier(0.2, 0, 0, 1);         /* state changes */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);  /* entrances settle softly */

  /* Focus ring */
  --focus-ring: 3px solid var(--color-accent);
}

/* Light and dark pairs: light-dark(LIGHT, DARK). Only browsers that support
   light-dark() apply these; the others keep the light values above. */
@supports (color: light-dark(#000, #fff)) {
  :root {
    /* Neutrals + single accent */
    --color-bg:             light-dark(#FFFFFF, #0F172A);
    --color-surface:        light-dark(#F8FAFC, #162033);
    --color-surface-sunken: light-dark(#F1F5F9, #1E293B);
    --color-text:           light-dark(#0F172A, #F1F5F9);
    --color-text-muted:     light-dark(#475569, #CBD5E1);
    --color-text-subtle:    light-dark(#64748B, #94A3B8);
    --color-border:         light-dark(#E2E8F0, #334155);
    --color-border-strong:  light-dark(#64748B, #748297);
    --color-accent:         light-dark(#1D4ED8, #60A5FA);
    --color-accent-hover:   light-dark(#1E40AF, #93C5FD);
    --color-accent-tint:    light-dark(#EFF6FF, #172554);
    --color-on-accent:      light-dark(#FFFFFF, #0F172A);   /* dark: dark text on light-blue fills (skip link, selection, logo) */
    /* Primary button: light is unchanged (the accent, darker on hover). Dark uses
       a deeper blue with white text, lighter on hover: white on #1D4ED8 6.7:1,
       on #2563EB 5.2:1. The focus ring stays the dark accent #60A5FA (7.0:1 on
       the page background, drawn 2px outside the button). */
    --color-primary:        light-dark(#1D4ED8, #1D4ED8);
    --color-primary-hover:  light-dark(#1E40AF, #2563EB);
    --color-on-primary:     light-dark(#FFFFFF, #FFFFFF);

    /* Status */
    --color-pass:           light-dark(#15803D, #6EE7B7);
    --color-pass-strong:    light-dark(#166534, #A7F3D0);
    --color-pass-tint:      light-dark(#F0FDF4, #062A22);
    --color-pass-border:    light-dark(#86EFAC, #065F46);
    --color-warn:           light-dark(#C77700, #FACC15);
    --color-warn-strong:    light-dark(#92400E, #FDE68A);
    --color-warn-tint:      light-dark(#FFFBEB, #2A2006);
    --color-warn-border:    light-dark(#FCD34D, #854D0E);
    --color-fail:           light-dark(#AA090E, #EF6B6B);
    --color-fail-strong:    light-dark(#991B1B, #FECACA);
    --color-fail-tint:      light-dark(#FEF2F2, #2C1216);
    --color-fail-border:    light-dark(#FCA5A5, #991B1B);
    --color-unknown:        light-dark(#475569, #94A3B8);
    --color-unknown-strong: light-dark(#475569, #CBD5E1);
    --color-unknown-tint:   light-dark(#F1F5F9, #1E293B);
    --color-unknown-border: light-dark(#CBD5E1, #475569);
    --color-info:           light-dark(#1D4ED8, #60A5FA);
    --color-info-strong:    light-dark(#1D4ED8, #93C5FD);
    --color-info-tint:      light-dark(#EFF6FF, #172554);
    --color-info-border:    light-dark(#BFDBFE, #1E40AF);
  }
}

@media (min-width: 640px) {
  :root { --gutter: var(--space-5); }
}


/* --------------------------------------------------------------------------
   2. Reset + base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

/* color-scheme is set on :root in section 1 and follows the active theme */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

img, svg { display: block; max-width: 100%; }

input, button, textarea, select { font: inherit; color: inherit; }

/* Larger, tighter headings: size steps carry the hierarchy (design-system.md 3) */
h1, h2, h3, h4 { text-wrap: balance; }
h1 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.1;  letter-spacing: -0.025em; }
h2 { font-size: var(--text-xl);  font-weight: 650; line-height: 1.2;  letter-spacing: -0.02em; }
h3 { font-size: var(--text-lg);  font-weight: 600; line-height: 1.4;  letter-spacing: -0.01em; }
h4 { font-size: var(--text-base); font-weight: 600; line-height: 1.4; }

p, li { text-wrap: pretty; }

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--duration) var(--ease),
              text-decoration-color var(--duration) var(--ease);
}
a:hover { color: var(--color-accent-hover); text-decoration-thickness: 2px; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-ligatures: none;   /* show "-all", "~all" exactly as typed */
}

/* Inline code chip */
:not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--color-surface-sunken);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

::selection { background: var(--color-accent); color: var(--color-on-accent); }

/* Visible keyboard focus on everything interactive. Never remove. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-6);
}


/* --------------------------------------------------------------------------
   3. Utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
/* Beat the generic a:hover (higher specificity) so text stays white on accent */
.skip-link:focus,
.skip-link:hover { color: var(--color-on-accent); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Tool pages (index.html, header-analyzer.html). Same width as every other
   page now (one grid), so the logo and headings never shift between pages. */
.container--tool { max-width: var(--container-tool); }

/* Keep running text at a comfortable reading width even inside the wider
   container. Records, tables, kv lists and form rows still use the full width. */
.container--tool p,
.container--tool li { max-width: var(--measure); }

/* Vertical rhythm: children spaced evenly */
.stack > * + * { margin-top: var(--stack-space, var(--space-4)); }
.stack--sm { --stack-space: var(--space-2); }
.stack--lg { --stack-space: var(--space-6); }

/* Wrapping horizontal row */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-space, var(--space-3));
}

/* 44px touch area for standalone links whose text is shorter than that
   (design-system.md 5). An invisible ::after, centred on the link, takes the
   taps; the link's text, underline, focus ring and layout don't change.
   Links inside running sentences are left alone. Where such links stack,
   their spacing keeps the touch areas from overlapping (.site-footer ul,
   .link-list below). */
.site-footer a,
.tool__faq-link a,
.guide-list a,
.link-list a,
.tap-44 { position: relative; }
.site-footer a::after,
.tool__faq-link a::after,
.guide-list a::after,
.link-list a::after,
.tap-44::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: max(100%, var(--tap));
  transform: translateY(-50%);
}

/* A short list of links (404 suggestions, privacy "learn more"): items one
   touch area apart, so the 44px areas never overlap. 1.7em = one prose line. */
/* ul.link-list (0,1,3) beats ".prose li + li" (0,1,2), which comes later.
   +4px: the link's text box sits a pixel or two off-centre in its line, so at
   exactly 44px apart neighbouring touch areas would just touch. */
ul.link-list li + li { margin-top: calc(var(--tap) + 4px - 1.7em); }

.muted { color: var(--color-text-muted); }
.mono  { font-family: var(--font-mono); font-variant-ligatures: none; overflow-wrap: anywhere; }

/* Long-form text (guides, legal, about): an editorial reading column.
   More space above a heading than below it (design-system.md 6.18). */
.prose { max-width: var(--measure); line-height: 1.7; }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-8); }
.prose h3 { margin-top: var(--space-6); }
.prose ul, .prose ol { padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose li::marker { color: var(--color-text-muted); }


/* --------------------------------------------------------------------------
   4. Page shell: header, main, footer
   -------------------------------------------------------------------------- */
/* Sticky only from 640px. On phones the header is two rows (brand, then the
   nav on one line under it), which would cover jumped-to finding titles and
   take a big share of a short screen if it stuck. */
.site-header {
  position: static;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 640px) {
  .site-header {
    position: sticky;
    top: 0;
  }
  /* Keep the sticky header from covering whatever is scrolled to: anchor jumps
     (#how-to-copy, #route-title, scorecard links) and elements reached with Tab
     or Shift+Tab (WCAG 2.4.11 Focus Not Obscured). Applies page-wide, so the
     per-element scroll-margin-top values were removed to avoid doubling it. */
  html { scroll-padding-top: 5rem; }
}
/* Brand left; nav and the theme toggle pushed right (the nav's auto margin).
   Phones: brand and toggle share the first row, the nav takes the second. */
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  min-height: 3.5rem;
  padding-block: var(--space-2);
}
.site-nav { margin-inline-start: auto; }
.site-header__brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);   /* 44px touch target; the header row is already this tall */
  gap: var(--space-2);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}
.site-header__brand:hover { color: var(--color-text); }
/* Logo mark: the envelope mark (an outline envelope on the accent square, same
   drawing as favicon.svg). Drawn inline so it follows the theme: accent tile,
   on-accent envelope (white on blue in light; dark navy on the lighter blue in
   dark, 7:1, where white would only reach 2.5:1). */
.site-header__mark {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
}
.site-header__mark rect { fill: var(--color-accent); }
.site-header__mark path {
  fill: none;
  stroke: var(--color-on-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-inline: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}
.site-nav a:hover { color: var(--color-text); }
/* Current page: text colour, semibold and an accent underline. Weight and the
   underline carry it, not colour alone, and no filled pill. aria-current is
   "page" on the tools and "true" on guide articles (the Guides section). */
.site-nav a[aria-current] {
  color: var(--color-text);
  font-weight: 600;
  text-decoration-line: underline;
  text-decoration-color: var(--color-accent);
}
/* Phones: the nav takes its own full-width row under the brand and keeps all
   three links on that one row (tighter padding, no wrap), instead of wrapping
   the last link to a third row. Pulled left so the first link's text lines up
   with the brand. Links keep the 44px touch height. */
@media (max-width: 639.98px) {
  .site-header__inner { gap: 0; padding-bottom: 0; }
  .theme-toggle { order: 1; margin-inline-start: auto; margin-inline-end: calc(-1 * var(--space-2)); }
  .site-nav { order: 2; flex-basis: 100%; margin-inline-start: calc(-1 * var(--space-2)); }
  .site-nav ul { flex-wrap: nowrap; gap: 0; }
  .site-nav a { padding-inline: var(--space-2); white-space: nowrap; }
}
/* Narrowest phones (320px, the WCAG reflow width): a step smaller so the
   three links still fit on the row without a sideways scroll */
@media (max-width: 359.98px) {
  .site-nav a { font-size: var(--text-sm); }
}

/* Theme toggle (assets/theme.js): a 44px icon button. The icon and the
   aria-label name the theme a click switches TO: a moon while light is on,
   a sun while dark is on. Hidden until the script runs. */
.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--duration) var(--ease),
              background-color var(--duration) var(--ease);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-sunken); }
.theme-toggle__icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle__sun { display: none; }
.theme-toggle[data-current="dark"] .theme-toggle__sun { display: block; }
.theme-toggle[data-current="dark"] .theme-toggle__moon { display: none; }
@media (forced-colors: active) {
  .theme-toggle { border: 1px solid ButtonText; }
}
/* Browsers without light-dark() only get the light theme (section 1), so a
   toggle there would do nothing: hide it. */
@supports not (color: light-dark(#000, #fff)) {
  .theme-toggle { display: none; }
}

main { flex: 1; padding-block: var(--space-5) var(--space-8); }
/* 32px above the h1 keeps the whole header-analyzer form (paste box and
   button) above the fold at 1280x800 */
@media (min-width: 640px) {
  main { padding-block: var(--space-6) var(--space-9); }
}

/* Footer: a background change separates it; no rule */
.site-footer {
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding-block: var(--space-6);
}
@media (min-width: 640px) {
  .site-footer { padding-block: var(--space-7); }
}
/* Copyright first, then the links, on one wrapping row */
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
}
.site-footer__copy { color: var(--color-text-muted); }
/* Row gap: when the links wrap (phones), rows sit one 44px touch area apart
   (a 14px line is 1.5em tall), so neighbouring touch areas don't overlap. */
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--tap) - 1.5em) var(--space-5);
  padding: 0;
  list-style: none;
}
.site-footer a { color: var(--color-text-muted); }
.site-footer a:hover { color: var(--color-text); }


/* --------------------------------------------------------------------------
   5. Tool hero (always above the fold)
   -------------------------------------------------------------------------- */
/* Not a hero: h1, one lead line and the form, nothing else. Phones keep the
   top tight so the form stays above the fold at 375x667 and 320x568. */
.tool { padding-block: var(--space-2) var(--space-6); }
.tool > * + * { margin-top: var(--space-3); }
.tool__lead { color: var(--color-text-muted); max-width: var(--measure); }
@media (min-width: 640px) {
  .tool { padding-block: 0 var(--space-7); }
  .tool__lead { font-size: var(--text-lg); line-height: 1.5; }
}
/* "Questions? See the FAQ": a small jump link right under the lead line.
   The sticky header can't cover the #faq target: html's scroll-padding-top
   (section 4) already offsets every anchor jump from 640px up, and below
   640px the header isn't sticky. */
.tool > .tool__faq-link { margin-top: var(--space-1); font-size: var(--text-sm); }

.tool__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-5);
  max-width: 44rem;
}
.tool__form .field { flex: 1; }

/* Full-width form row (domain checker: domain + selector + button) */
.tool__form--wide { max-width: none; }

@media (min-width: 640px) {
  .tool__form {
    flex-direction: row;
    align-items: flex-start;
  }
  /* A secondary field that stays narrow next to the main one */
  .tool__form .field--compact { flex: 0 1 15rem; }
  /* Line the button up with the input, below the label */
  .tool__form > .btn { margin-top: calc(var(--text-sm) * 1.5 + var(--space-1)); }
}


/* --------------------------------------------------------------------------
   6. Form fields
   -------------------------------------------------------------------------- */
.field > * + * { margin-top: var(--space-1); }

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
}
.field__help {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-fail);
}
.field__error svg { flex: none; width: 1.125rem; height: 1.125rem; margin-top: 0.1em; }
/* "Try an example: emailauthgrade.com" under the domain field */
.field__example { font-size: var(--text-sm); color: var(--color-text-muted); }

.input,
.textarea {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);   /* 16px: prevents iOS zoom on focus */
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.input::placeholder,
.textarea::placeholder { color: var(--color-text-subtle); opacity: 1; }

.input:hover,
.textarea:hover { border-color: var(--color-text); }

.input:focus-visible,
.textarea:focus-visible {
  /* Transparent, not none: forced-colors mode drops box-shadow but paints this outline */
  outline: 3px solid transparent;
  outline-offset: 2px;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent);
}

.input--mono { font-family: var(--font-mono); font-variant-ligatures: none; }

.textarea {
  min-height: 12rem;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  font-variant-ligatures: none;
  white-space: pre;
  overflow-x: auto;
}
/* Short screens (up to 800px tall, e.g. a 1366x768 laptop): a 12rem box, about
   eight lines, instead of the 12 rows set in the HTML, so "Analyze headers"
   is visible without scrolling. Still resizable; a height the visitor drags
   to is kept (inline style wins). */
@media (max-height: 800px) {
  .textarea { height: 12rem; }
}

/* Invalid: colored border AND visible error text below (never color alone) */
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--color-fail);
  border-width: 2px;
}


/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-2) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}
.btn__icon { flex: none; width: 1.125rem; height: 1.125rem; }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn--primary:hover { background: var(--color-primary-hover); color: var(--color-on-primary); }

.btn--secondary {
  background: var(--color-bg);
  color: var(--color-accent);
  border-color: var(--color-border-strong);
}
.btn--secondary:hover {
  background: var(--color-accent-tint);
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-accent);
  padding-inline: var(--space-3);
}
.btn--ghost:hover { background: var(--color-accent-tint); color: var(--color-accent-hover); }

.btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
}

.btn[disabled],
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }

/* Full-width on phones where requested */
.btn--block { width: 100%; }
@media (min-width: 640px) { .btn--block { width: auto; } }


/* --------------------------------------------------------------------------
   8. Status system: color + icon shape + label, never color alone
   Each modifier sets local custom properties; components read them.
   -------------------------------------------------------------------------- */
.is-pass, .status--pass, .finding--pass, .grade--pass, .notice--pass {
  --tone: var(--color-pass);
  --tone-strong: var(--color-pass-strong);
  --tone-tint: var(--color-pass-tint);
  --tone-border: var(--color-pass-border);
}
.is-warn, .status--warn, .finding--warn, .grade--warn, .notice--warn {
  --tone: var(--color-warn);
  --tone-strong: var(--color-warn-strong);
  --tone-tint: var(--color-warn-tint);
  --tone-border: var(--color-warn-border);
}
.is-fail, .status--fail, .finding--fail, .grade--fail, .notice--fail {
  --tone: var(--color-fail);
  --tone-strong: var(--color-fail-strong);
  --tone-tint: var(--color-fail-tint);
  --tone-border: var(--color-fail-border);
}
.is-unknown, .status--unknown, .finding--unknown, .grade--unknown, .notice--unknown {
  --tone: var(--color-unknown);
  --tone-strong: var(--color-unknown-strong);
  --tone-tint: var(--color-unknown-tint);
  --tone-border: var(--color-unknown-border);
}
.is-info, .status--info, .finding--info, .notice--info, .notice--privacy {
  --tone: var(--color-info);
  --tone-strong: var(--color-info-strong);
  --tone-tint: var(--color-info-tint);
  --tone-border: var(--color-info-border);
}

/* Status badge */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.2rem 0.65rem 0.2rem 0.45rem;
  background: var(--tone-tint, var(--color-surface-sunken));
  border: 1px solid var(--tone-border, var(--color-border));
  border-radius: var(--radius-pill);
  color: var(--tone-strong, var(--color-text));
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
/* Every drawn icon uses one stroke weight (2 on a 24px grid). */
.status__icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--tone, currentColor);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Shared defaults for sprite icons referenced with <use> */
.icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn__icon,
.field__error svg,
.notice__icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* --------------------------------------------------------------------------
   9. Grade summary
   -------------------------------------------------------------------------- */
.grade {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--tone-border, var(--color-border));
  border-radius: var(--radius-md);
}
.grade__letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  background: var(--tone-tint, var(--color-surface-sunken));
  border: 2px solid var(--tone, var(--color-border-strong));
  border-radius: var(--radius-md);
  color: var(--tone-strong, var(--color-text));
  font-size: var(--text-grade);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
/* Verdict variant (header analyzer): a status icon in place of the letter.
   The icon shape plus the visible title carry the meaning, never color alone.
   No tile behind it: the tile belongs to the grade letter (design-system.md 6.6). */
.grade__letter--icon {
  width: auto;
  height: auto;
  background: none;
  border: 0;
}
.grade__letter--icon svg {
  width: 0.75em;
  height: 0.75em;
  fill: none;
  stroke: var(--tone, currentColor);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.grade__body > * + * { margin-top: var(--space-1); }
.grade__title {
  font-size: var(--text-xl);
  /* Focus moves here after a check; keep the ring tight around the words,
     not the full width of the column */
  width: fit-content;
  border-radius: var(--radius-sm);
}
.grade__reason { font-size: var(--text-lg); line-height: 1.5; }
.grade__meta { font-size: var(--text-sm); color: var(--color-text-muted); }
/* "Copy link to this result". The link text stays hidden unless the clipboard
   is unavailable; then it's shown so it can be selected. */
.grade__body > .grade__share { margin-top: var(--space-3); }
/* Let the label wrap rather than push past the grade box on 320px phones */
.grade__share .btn { max-width: 100%; white-space: normal; text-align: left; }
.grade__link:not([hidden]) {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* Small phones: keep the tile beside the title (a smaller tile) instead of giving
   it a row of its own above "Grade A". */
@media (max-width: 399.98px) {
  .grade { align-items: flex-start; gap: var(--space-3); padding: var(--space-4); }
  .grade__letter { font-size: 2.75rem; }
}

/* Headings focused in script (the grade, the verdict): the ring shows only when
   the browser treats the focus as keyboard focus (:focus-visible). The domain
   checker passes focus({ focusVisible }) so a mouse or touch submit never shows it. */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

/* Scorecard: one link per check under the grade, jumping to its finding card.
   One bordered strip with dividers between items, not a row of separate boxes.
   The dividers are the strip's border colour showing through a 1px gap
   between items, so they stay right however the items wrap.
   Phones: a single-column list, name left and badge right.
   >=640px: name with its badge beside it, in rows: 2 per row up to 960px;
   from 960px, 4 checks (domain checker) sit in one row and 5-6 (header
   analyzer) go 3 per row. Items on a short last row stretch to fill it. */
.scorecard {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  list-style: none;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;   /* clip the items to the rounded corners */
}
/* max-width: none opts out of the reading-width cap on .container--tool li,
   which would stop a stretched last item short of the strip's edge */
.scorecard li { max-width: none; background: var(--color-bg); }
.scorecard a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  height: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease);
}
.scorecard a:hover { background: var(--color-surface); color: var(--color-text); }
/* Badges a step up from the 13px default so the strip reads at a glance */
.scorecard .status { font-size: var(--text-sm); }
/* Draw the focus ring inside the item, since the strip clips anything outside */
.scorecard a:focus-visible { outline-offset: -3px; }

/* Phones: one compact row. Each cell is the status icon above the check name;
   the status word stays in the accessible name (visually hidden), because
   "Warning" beside each name can't fit 4-6 cells across 288px. The full badge
   is repeated on each card just below (design-system.md 6.6, exception). */
@media (max-width: 639.98px) {
  .scorecard { flex-direction: row; }
  /* Equal shares of the row, but never narrower than the longest word, so a
     two-word name ("Display name") wraps inside its cell instead of overflowing */
  .scorecard li { flex: 1 1 0; min-width: min-content; }
  .scorecard a {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: var(--space-2) var(--space-1);
    font-size: var(--text-sm);
    line-height: 1.2;
    text-align: center;
  }
  .scorecard .status {
    order: -1;
    padding: 0;
    background: none;
    border: 0;
  }
  .scorecard .status__icon { width: 1.125rem; height: 1.125rem; }
}
/* Six checks (the analyzer's display-name flag) can't share 288px without
   cells under the 44px touch-target width, so below 360px they go 3 + 3. */
@media (max-width: 359.98px) {
  .scorecard:has(> li:nth-child(6)) { flex-wrap: wrap; }
  .scorecard:has(> li:nth-child(6)) li { flex-basis: calc(33.333% - 1px); }
}
@media (max-width: 639.98px) {
  .scorecard .status__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 640px) {
  .scorecard { flex-direction: row; flex-wrap: wrap; }
  .scorecard li { flex: 1 1 calc(50% - 1px); }
  /* Name first, badge right after it (wraps under the name only as a fallback) */
  .scorecard a { flex-wrap: wrap; justify-content: flex-start; }
}
@media (min-width: 960px) {
  .scorecard li { flex-basis: 0; }
  .scorecard:has(> li:nth-child(5)) li { flex-basis: calc(33.333% - 1px); }
}


/* --------------------------------------------------------------------------
   10. Results list + finding card
   -------------------------------------------------------------------------- */
.results > * + * { margin-top: var(--space-4); }
.results:empty { display: none; }
/* Shared result link (index.html#domain=…, html.shared-result set in <head>):
   reserve the loading state's height before the first paint, so the sections
   below don't move when the placeholders appear. The loading state is the
   "Checking…" line (1.6em) + three skeletons (7rem, 8rem, 8rem) with a 16px gap
   before each, as built by renderLoading() in index.html. Keep the two in step. */
.shared-result .results:empty {
  display: block;
  min-height: calc(var(--text-base) * 1.6 + 3 * var(--space-4) + 7rem + 8rem + 8rem);
}
/* Section headings in results ("Route") are link targets too */
.results > h2 { margin-top: var(--space-7); }

/* Results appearing: the one authored motion moment. Each top-level block
   fades in and rises 8px, 40ms apart, capped at 200ms. The resting state is
   fully visible, so nothing is hidden if the animation doesn't run. */
.results > * { animation: rise-in var(--duration-enter) var(--ease-out) both; }
.results > :nth-child(2) { animation-delay: 40ms; }
.results > :nth-child(3) { animation-delay: 80ms; }
.results > :nth-child(4) { animation-delay: 120ms; }
.results > :nth-child(5) { animation-delay: 160ms; }
.results > :nth-child(n+6) { animation-delay: 200ms; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
}

.finding {
  padding: var(--space-4);
  background: var(--color-bg);
  /* Full border in the status hue: a quiet extra cue; the badge carries the meaning */
  border: 1px solid var(--tone-border, var(--color-border));
  border-radius: var(--radius-md);
}
/* Only cards that need a look (warn, fail, unknown) get a coloured border.
   Pass and info cards stay neutral; their badges keep their colours. */
.finding--pass,
.finding--info { border-color: var(--color-border); }
/* Long unbroken tokens ("<selector>._domainkey.example.com", long hostnames)
   wrap inside the card instead of pushing the page wider on phones. */
.finding { overflow-wrap: break-word; }
@media (min-width: 640px) {
  .finding { padding: var(--space-5); }
}

.finding__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}
.finding__title { font-size: var(--text-lg); }
.finding__summary { margin-top: var(--space-1); }

.finding__section { margin-top: var(--space-4); }
.finding__section > * + * { margin-top: var(--space-2); }
.finding__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Header analyzer cards: a neutral border with a thin status-coloured left
   edge. The badge carries the status; the edge helps scanning down the list.
   Padding drops by the edge's extra 2px so the text stays on the same line
   as other cards. Info cards keep a neutral edge. */
.finding--edge {
  border-color: var(--color-border);
  border-left: 3px solid var(--tone, var(--color-border));
  padding-left: calc(var(--space-4) - 2px);
}
.finding--edge.finding--info { border-left-color: var(--color-border); }
@media (min-width: 640px) {
  .finding--edge { padding-left: calc(var(--space-5) - 2px); }
}

/* "What to do" in the header analyzer: a plain subheading, no nested box */
.finding__todo .finding__label { color: var(--color-text); }

/* The fix is the payoff: a quiet tint, no second border inside the card */
.finding__fix {
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}
.finding__fix .finding__label { color: var(--color-text); }

/* Clean pass: detail collapsed, the one-line fix ("Nothing to fix.") stays visible.
   No rule above the disclosure inside a card: the card is the only frame. */
.finding__details { margin-top: var(--space-2); }
.disclosure.finding__details { border-top: 0; padding-top: 0; }   /* beats .disclosure below */
.finding__details .disclosure__body > * + * { margin-top: var(--space-2); }
.finding__details .finding__label + * { margin-top: var(--space-1); }
.finding__details .disclosure__body > .finding__label { margin-top: var(--space-4); }
.finding__details .disclosure__body > .finding__label:first-child { margin-top: 0; }
.finding__fix-line {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Individual observations in a finding: status icon + text (label in a
   visually hidden prefix). Items use .is-<status> to set the icon color. */
.issues { padding: 0; list-style: none; }
.issues li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.issues li + li { margin-top: var(--space-2); }
.issues .status__icon { margin-top: 0.3em; }

/* Small caption naming where a record lives ("TXT record at _dmarc.example.com") */
.finding__target { font-size: var(--text-sm); color: var(--color-text-muted); }

/* Ordered steps inside a fix */
.finding__steps { padding-left: var(--space-5); }
.finding__steps li + li { margin-top: var(--space-2); }


/* --------------------------------------------------------------------------
   11. Record / code blocks
   -------------------------------------------------------------------------- */
/* Records keep their border: they hold literal data (design-system.md 4) */
.record {
  margin: 0;
  padding: var(--space-3);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.55;
  font-variant-ligatures: none;
  /* Wrap long TXT values so the whole record is visible on phones */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.record code { background: none; padding: 0; }

/* Record with a copy button */
.record--copyable {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  white-space: normal;
}
.record__value {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (min-width: 640px) {
  .record--copyable {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
  .record--copyable .copy-btn { flex: none; }
}

/* Raw header text: preserve exact formatting, scroll instead of wrapping */
.raw {
  margin: 0;
  max-height: 24rem;
  overflow: auto;
  padding: var(--space-3);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre;
}

/* Copy button feedback (toggle data-copied="true" in JS for ~2s) */
.copy-btn .icon-done { display: none; }
.copy-btn .btn__icon { transition: opacity var(--duration) var(--ease); }
.copy-btn[data-copied="true"] {
  color: var(--color-pass-strong);
  border-color: var(--color-pass);
  background: var(--color-pass-tint);
}
.copy-btn[data-copied="true"] .icon-copy { display: none; }
.copy-btn[data-copied="true"] .icon-done { display: block; }


/* --------------------------------------------------------------------------
   12. Disclosure (secondary detail; never used to hide the fix)
   -------------------------------------------------------------------------- */
.disclosure {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
}
.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  transition: color var(--duration) var(--ease);
}
.disclosure > summary::-webkit-details-marker { display: none; }
/* Chevron: 2px strokes, the same weight as the sprite icons */
.disclosure > summary::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--duration-enter) var(--ease-out);
}
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:hover { color: var(--color-accent-hover); }
.disclosure__body > * + * { margin-top: var(--space-3); }
.disclosure__body { padding-block: var(--space-2) var(--space-3); }
/* Opening: the body fades in and drops 4px into place */
.disclosure[open] > .disclosure__body {
  animation: drop-in var(--duration-enter) var(--ease-out);
}
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-4px); }
}


/* --------------------------------------------------------------------------
   13. Key–value list (parsed tags, header fields)
   -------------------------------------------------------------------------- */
/* Hairline rows, no outer box (design-system.md 6.10) */
.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-block: 1px solid var(--color-border);
}
.kv__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1);
  padding-block: var(--space-3);
}
.kv__row + .kv__row { border-top: 1px solid var(--color-border); }
.kv__key {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}
.kv__value { margin: 0; overflow-wrap: anywhere; }
.kv__value--mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-ligatures: none;
}
@media (min-width: 640px) {
  .kv__row {
    grid-template-columns: minmax(9rem, 14rem) 1fr;
    gap: var(--space-4);
    align-items: baseline;
  }
}


/* --------------------------------------------------------------------------
   14. Table (Received hops)
   -------------------------------------------------------------------------- */
/* No outer box: caption, a header row with a hairline under it, hairlines
   between rows. First and last columns sit flush with the text column. */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  line-height: 1.5;
}
.table caption {
  padding-block: 0 var(--space-2);
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
}
.table th,
.table td {
  padding: var(--space-3);
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--color-border);
}
.table th:first-child,
.table td:first-child { padding-left: 0; }
.table th:last-child,
.table td:last-child { padding-right: 0; }
.table thead th {
  padding-block: var(--space-2);
  border-top: 0;
  border-bottom: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 1px solid var(--color-border); }
.table td.mono { font-size: var(--text-sm); min-width: 12rem; }
/* Guide and legal tables on phones: the 12rem minimum is for the analyzer's
   long hostnames. Here it pushed tables past the screen, and without a frame
   nothing shows that they scroll, so let short tag names size to their text
   (long ones wrap, .mono has overflow-wrap: anywhere). */
@media (max-width: 639.98px) {
  .prose .table td.mono { min-width: 0; }
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Phones: a .table--stack table (the Received hops) shows one block per row,
   each cell as "label: value" from its data-label, so the time and delay
   columns don't hide off to the right. Header cells stay for screen readers. */
@media (max-width: 639.98px) {
  .table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .table--stack tbody tr { display: block; border-top: 1px solid var(--color-border); padding-block: var(--space-2); }
  .table--stack tbody tr:last-child { border-bottom: 1px solid var(--color-border); }
  /* Label in a fixed left column (positioned, so a cell's own line breaks and
     spans, like the From cell's IP and notes, stay together on the right).
     .table.table--stack td beats .table td:first-child/:last-child above. */
  .table.table--stack td {
    display: block;
    position: relative;
    border-top: 0;
    border-bottom: 0;
    padding-block: var(--space-1);
    padding-left: calc(5.5rem + var(--space-3));
    padding-right: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table--stack td.mono { min-width: 0; }
  .table--stack td.num { text-align: left; }   /* beat .table .num's right align */
  .table--stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 5.5rem;
    text-align: left;
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-text-muted);
  }
  .table--stack td:empty { display: none; }
}


/* --------------------------------------------------------------------------
   15. Notice (privacy statement, inline warnings)
   -------------------------------------------------------------------------- */
/* Tint only, no border: icon + text + tint carry it (forced colors adds one back) */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--tone-tint, var(--color-surface));
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.notice__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1em;
  color: var(--tone, var(--color-text-muted));
}
.notice__title { font-weight: 600; color: var(--tone-strong, var(--color-text)); }
.notice > div > * + * { margin-top: var(--space-1); }

/* Header analyzer privacy notice: the full text from 480px, a one-sentence
   version below it so the paste box stays above the fold on phones. Only one
   version is displayed, so screen readers (and the textarea's description)
   get exactly the text on screen. */
.notice__short { display: none; }
.notice__short strong { color: var(--tone-strong, var(--color-text)); }
@media (max-width: 479.98px) {
  .notice .notice__full { display: none; }
  .notice .notice__short { display: block; margin-top: 0; }
}


/* --------------------------------------------------------------------------
   16. Loading + skeletons
   -------------------------------------------------------------------------- */
/* Block-level flex (not inline-flex): exactly one line tall, with no extra
   baseline space, so the reserved height for shared result links matches. */
.loading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-weight: 500;
}
.loading::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Flat block that pulses in opacity (no gradient shimmer) */
.skeleton {
  min-height: var(--skeleton-height, 8rem);
  background: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  animation: pulse 1.4s ease-in-out infinite alternate;
}

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


/* --------------------------------------------------------------------------
   17. Ad slot: reserved space, clearly labeled, never above the tool
   -------------------------------------------------------------------------- */
.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--ad-height, 280px);   /* reserve space: no layout shift */
  margin-block: var(--space-7);
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}
.ad-slot__label {
  align-self: flex-start;
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
}
@media (min-width: 960px) {
  .ad-slot { --ad-height: 120px; }   /* leaderboard height on desktop */
}


/* --------------------------------------------------------------------------
   18. Two-column results layout on wide screens (optional)
   -------------------------------------------------------------------------- */
@media (min-width: 960px) {
  .layout-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
  }
}


/* --------------------------------------------------------------------------
   19. Reduced motion: no transitions, static loaders
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .loading::before { display: none; }   /* "Checking…" text remains */
  /* No entrances, pulses or staggered delays: everything is simply there */
  .skeleton,
  .results > *,
  .disclosure[open] > .disclosure__body { animation: none !important; }
}


/* --------------------------------------------------------------------------
   20. Forced colors (Windows High Contrast): keep status shapes visible
   -------------------------------------------------------------------------- */
@media (forced-colors: active) {
  .status,
  .notice,
  .callout,
  .finding__fix,
  .grade__letter { border: 1px solid CanvasText; }
  .grade__letter--icon { border: 0; }
  .finding { border: 1px solid CanvasText; }
  .finding--edge { border-left-width: 3px; }
  .btn { border: 1px solid ButtonText; }
}


/* --------------------------------------------------------------------------
   21. Page sections below the tool (explainer, FAQ)
   -------------------------------------------------------------------------- */
/* Separated by whitespace alone, no rule (design-system.md 6.17) */
.page-section { margin-top: var(--space-8); }
@media (min-width: 640px) {
  .page-section { margin-top: var(--space-9); }
}
.page-section > * + * { margin-top: var(--space-4); }
.page-section > h3 { margin-top: var(--space-6); }
.page-section .kv { margin-top: var(--space-5); }

/* No results yet: the first section sits closer to the tool. Once results
   are showing, .results isn't empty and the normal gap applies. */
.results:empty + .page-section { margin-top: var(--space-6); }
@media (min-width: 640px) {
  .results:empty + .page-section { margin-top: var(--space-7); }
}
/* Shared result link: space is reserved for the loading state (section 10),
   so use the normal gap from the start; otherwise the section would still
   move when the placeholders arrive and the gap grows. */
.shared-result .results:empty + .page-section { margin-top: var(--space-8); }
@media (min-width: 640px) {
  .shared-result .results:empty + .page-section { margin-top: var(--space-9); }
}

/* Explainer key/value lists ("What this checks"): record names (MX, SPF, DKIM,
   DMARC) in the sans-serif at semibold and the text colour, a narrow label
   column, and the same reading width as the paragraphs around them. They're
   names here, not literal data to copy, so not monospace. Result cards' kv
   lists are unchanged. */
.page-section .kv { max-width: var(--measure); }
.page-section .kv__key {
  font-weight: 600;
  color: var(--color-text);
}
@media (min-width: 640px) {
  .page-section .kv__row { grid-template-columns: 5rem 1fr; }
}

/* FAQ: a stack of .disclosure items, closed off with a bottom rule */
.faq { margin-top: var(--space-4); }
.faq .disclosure:last-child { border-bottom: 1px solid var(--color-border); }


/* --------------------------------------------------------------------------
   22. Content pages: guides, legal, about, contact, 404 (design-system.md 6.18)
   -------------------------------------------------------------------------- */
.page-header {
  max-width: var(--measure);
  padding-bottom: var(--space-6);
}
@media (min-width: 640px) {
  .page-header { padding-bottom: var(--space-7); }
}
.page-header > * + * { margin-top: var(--space-3); }
.page-header__eyebrow { font-size: var(--text-sm); color: var(--color-text-muted); }
.page-header__lead { font-size: var(--text-lg); line-height: 1.55; color: var(--color-text-muted); }
/* The article's first heading follows the header's own spacing */
.page-header + h2 { margin-top: 0; }

/* Example records and tables inside long-form text get the same rhythm as text */
.prose .record { max-width: 100%; line-height: 1.55; }
.prose .table-wrap { margin-top: var(--space-5); }
.prose .table-wrap + p { margin-top: var(--space-5); }
.prose h2 + *, .prose h3 + * { margin-top: var(--space-3); }

/* Points from a guide to the relevant tool. Accent tint, no border: it's a
   link, not a result. */
.callout {
  margin-top: var(--space-6);
  padding: var(--space-5);
  background: var(--color-accent-tint);
  border-radius: var(--radius-md);
}
.callout > * + * { margin-top: var(--space-2); }
.callout__title { font-weight: 600; }

/* "Draft: review before publishing" on legal pages. Neutral on purpose. */
.draft-banner {
  --tone-tint: var(--color-surface);
  border: 1px solid var(--color-border-strong);   /* keeps its border: must not be missed */
  margin-bottom: var(--space-5);
}

/* Guides index: hairline-separated list; titles underline on hover and focus */
.guide-list { padding: 0; list-style: none; max-width: var(--measure); }
.guide-list li { padding-block: var(--space-5); border-top: 1px solid var(--color-border); }
.guide-list li:last-child { border-bottom: 1px solid var(--color-border); }
.guide-list a {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  text-decoration: none;
}
.guide-list a:hover,
.guide-list a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }
.guide-list p { margin-top: var(--space-2); color: var(--color-text-muted); }
