/* dmarc.cc — bulk DMARC + SPF checker
   Brand: SH Consulting (orange, cream, dark, Inter)
   Layout: dark hero with dot grid, cream results section, sticky CTA bar.
*/

:root {
  --orange: #F97B22;
  --orange-700: #d96514;
  --orange-100: #fce5d2;
  --cream: #F6F3ED;
  --cream-300: #ebe6dc;
  --dark: #0D0D0D;
  --dark-700: #1a1a1a;
  --dark-500: #2a2a2a;

  --green: #22c55e;
  --green-bg: #d1fadf;
  --yellow: #eab308;
  --yellow-bg: #fef3c7;
  --red: #ef4444;
  --red-bg: #fee2e2;

  --text: var(--dark);
  --text-muted: #525252;
  --text-faint: #8a8a8a;
  --border: #d4d4d4;
  --border-dark: #2a2a2a;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow: 0 4px 12px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 20px 40px rgb(0 0 0 / 0.15);

  --container: 1100px;
  --header-h: 60px;
  --sticky-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: var(--sticky-h);
}

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

button { font-family: inherit; cursor: pointer; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--dark);
  color: #fff;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border-dark);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
}
.site-header .logo {
  font-weight: 700; font-size: 1.125rem; color: #fff;
  display: flex; align-items: center; gap: 0.5rem;
}
.site-header .logo .dot { color: var(--orange); }
.site-header nav a {
  color: #cfcfcf; font-weight: 500; font-size: 0.95rem; margin-left: 1.5rem;
}
.site-header nav a:hover { color: #fff; text-decoration: none; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- hero ---------- */

.hero {
  background: var(--dark);
  color: #f5f5f5;
  padding: 3.5rem 0 2.5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  /* dot grid pattern (same family as deliverability.guide) */
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.08) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  pointer-events: none;
}
.hero .container { position: relative; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  line-height: 1.15;
}
.hero .tagline {
  color: #d0d0d0; font-size: 1.0625rem; margin: 0 0 2rem; max-width: 620px;
}

/* ---------- scan form ---------- */

.scan-form { display: grid; gap: 1rem; max-width: 680px; }

.scan-form textarea {
  width: 100%; min-height: 140px;
  padding: 0.875rem 1rem;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9375rem; line-height: 1.5;
  color: #fff;
  background: var(--dark-700);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  resize: vertical;
  transition: border-color 0.15s;
}
.scan-form textarea::placeholder { color: #6b6b6b; }
.scan-form textarea:focus {
  outline: none; border-color: var(--orange);
}

.filedrop {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 1rem;
  border: 1px dashed #444; border-radius: var(--radius);
  color: #b0b0b0;
  font-size: 0.9375rem;
  background: rgb(255 255 255 / 0.02);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  cursor: pointer;
}
.filedrop:hover, .filedrop.dragover {
  border-color: var(--orange); color: #fff;
  background: rgb(249 123 34 / 0.06);
}
.filedrop input[type="file"] { display: none; }
.filedrop .accepted { color: #8a8a8a; font-size: 0.875rem; }

.scan-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.scan-count {
  color: #b0b0b0; font-size: 0.9375rem;
}
.scan-count strong { color: #fff; font-weight: 600; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem; font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 0.1s, background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--orange-700); text-decoration: none; }

.btn-secondary {
  background: transparent;
  color: #f5f5f5;
  border-color: #444;
}
.btn-secondary:hover:not(:disabled) {
  border-color: #888; text-decoration: none;
}

.btn-light { background: var(--dark); color: #fff; }
.btn-light:hover:not(:disabled) { background: var(--dark-500); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: rgb(0 0 0 / 0.04); text-decoration: none; }

.btn-block { width: 100%; }

/* ---------- validation feedback ---------- */

.validation {
  background: rgb(234 179 8 / 0.08);
  border-left: 3px solid var(--yellow);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  color: #fef3c7;
  font-size: 0.875rem;
  display: none;
}
.validation.show { display: block; }
.validation strong { color: #fff; }
.validation .rejected-list {
  display: inline; color: #fde68a;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

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

.results {
  background: var(--cream);
  padding: 2rem 0 4rem;
  display: none;
}
.results.show { display: block; }

.results-summary {
  display: flex; gap: 2rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cream-300);
}
.results-summary .stat {
  display: flex; flex-direction: column; gap: 0.125rem;
}
.results-summary .stat .num {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em;
}
.results-summary .stat .label {
  font-size: 0.8125rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.results-summary .actions {
  margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap;
}

.results-table-wrap { overflow-x: auto; }
.results-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-width: 700px;
}
.results-table thead th {
  background: var(--cream-300);
  text-align: left;
  font-size: 0.8125rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.results-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--cream-300);
  vertical-align: top;
}
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr:hover { background: var(--cream); }

.results-table .domain { font-weight: 600; word-break: break-all; }
.results-table .record {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem; line-height: 1.5;
  color: var(--text-muted);
  word-break: break-all;
  max-width: 360px;
}
.results-table .record.empty { color: var(--text-faint); font-style: italic; }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 999px; display: inline-block;
}
.status-pill.green { background: var(--green-bg); color: #15803d; }
.status-pill.green .dot { background: var(--green); }
.status-pill.yellow { background: var(--yellow-bg); color: #854d0e; }
.status-pill.yellow .dot { background: var(--yellow); }
.status-pill.red { background: var(--red-bg); color: #991b1b; }
.status-pill.red .dot { background: var(--red); }

.details-toggle {
  font-size: 0.8125rem; color: var(--orange); cursor: pointer;
  background: none; border: none; padding: 0;
}
.details-toggle:hover { text-decoration: underline; }

.details {
  display: none;
  background: var(--cream);
  padding: 0.75rem 1rem !important;
}
.details.show { display: table-row; }
.details td {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
}
.details dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.375rem 1rem;
  margin: 0;
}
.details dt { font-weight: 600; color: var(--text-muted); }
.details dd {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  word-break: break-all;
}
.details dd.empty { color: var(--text-faint); font-style: italic; font-family: inherit; }

/* ---------- empty + error states ---------- */

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

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

.site-footer {
  background: var(--dark);
  color: #b0b0b0;
  padding: 2rem 0 3rem;
  font-size: 0.875rem;
}
.site-footer .container {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
}
.site-footer a { color: #d0d0d0; }
.site-footer a:hover { color: #fff; }

/* ---------- sticky CTA ---------- */

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--sticky-h);
  background: var(--dark);
  border-top: 1px solid var(--border-dark);
  display: flex; align-items: center;
  box-shadow: 0 -4px 12px rgb(0 0 0 / 0.08);
}
.sticky-cta .container {
  display: flex; align-items: center; gap: 1rem;
  width: 100%; flex-wrap: wrap;
}
.sticky-cta .pitch {
  flex: 1; min-width: 200px;
  color: #f5f5f5; font-size: 0.9375rem; font-weight: 500;
}
.sticky-cta .pitch .quiet { color: #b0b0b0; font-weight: 400; }
.sticky-cta .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- modals ---------- */

dialog {
  border: none; padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px; width: calc(100% - 2rem);
  background: #fff;
  color: var(--text);
}
dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(2px);
}

.modal-body { padding: 1.75rem; }
.modal-body h2 {
  font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}
.modal-body .lede { color: var(--text-muted); margin: 0 0 1.25rem; }

.field { display: grid; gap: 0.375rem; margin-bottom: 1rem; }
.field label {
  font-size: 0.8125rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.field input, .field textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: inherit; font-size: 0.9375rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgb(249 123 34 / 0.15);
}
.field .help { font-size: 0.8125rem; color: var(--text-faint); }

.modal-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem;
  flex-wrap: wrap;
}

.confirmation { text-align: center; }
.confirmation .check {
  width: 56px; height: 56px; margin: 0 auto 1rem;
  background: var(--green-bg);
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: #15803d; font-size: 1.75rem; font-weight: 700;
}

.dmarc-hint {
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--cream);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  word-break: break-all;
  color: var(--text-muted);
}
.dmarc-hint .key { color: var(--orange); font-weight: 600; }

/* ---------- toast ---------- */

.toast {
  position: fixed; top: 1rem; right: 1rem; z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--dark);
  color: #fff;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.error { background: var(--red); }

/* ---------- spinner ---------- */

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- blog index ---------- */

.blog-empty {
  max-width: 640px; margin: 0 auto;
  padding: 4rem 1.25rem; text-align: center;
}
.blog-empty h1 { font-size: 2rem; margin: 0 0 0.5rem; letter-spacing: -0.02em; }
.blog-empty p { color: var(--text-muted); font-size: 1.0625rem; }

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .hero { padding: 2rem 0 1.5rem; }
  .hero h1 { font-size: 1.625rem; }
  .results { padding: 1.5rem 0 3rem; }
  .results-summary { gap: 1.25rem; }
  .results-summary .stat .num { font-size: 1.25rem; }
  .results-summary .actions { margin-left: 0; width: 100%; }
  .results-table { font-size: 0.8125rem; }
  .results-table thead th, .results-table tbody td { padding: 0.625rem 0.75rem; }
  .results-table .record { max-width: 220px; }
  .sticky-cta .pitch { font-size: 0.875rem; }
  .sticky-cta .actions { width: 100%; }
  .sticky-cta .actions .btn { flex: 1; }
  .modal-body { padding: 1.25rem; }
  dialog { width: calc(100% - 1rem); }
}
