/* Test One Mail — Editorial Design System */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-muted: #efefed;

  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --ink-3: #8a8a8a;
  --ink-4: #b5b5b5;

  --rule: #e0e0de;
  --rule-light: #eeeeec;

  --accent: #c0392b;
  --accent-soft: #fdf2f1;

  --color-pass: #1a7a4c;
  --color-pass-bg: #edf7f1;
  --color-fail: #c0392b;
  --color-fail-bg: #fdf2f1;
  --color-warn: #b8860b;
  --color-warn-bg: #fdf8ed;

  --page-max: 720px;
  --page-wide: 1600px;
}

[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-soft: #1a1a1a;
  --bg-muted: #252525;

  --ink: #e8e8e8;
  --ink-2: #a0a0a0;
  --ink-3: #666666;
  --ink-4: #444444;

  --rule: #2a2a2a;
  --rule-light: #1f1f1f;

  --accent: #e74c3c;
  --accent-soft: #2a1513;

  --color-pass: #2ecc71;
  --color-pass-bg: #0f2a1a;
  --color-fail: #e74c3c;
  --color-fail-bg: #2a1513;
  --color-warn: #f1c40f;
  --color-warn-bg: #2a2510;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Page structure */
.page {
  max-width: var(--page-wide);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* Masthead */
.masthead {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 1rem;
  margin-bottom: 3rem;
}

.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.masthead-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
}

.masthead-logo {
  height: 32px;
  width: 32px;
}

.masthead-logo-light { display: block; }
.masthead-logo-dark { display: none; }

[data-theme="dark"] .masthead-logo-light { display: none; }
[data-theme="dark"] .masthead-logo-dark { display: block; }

.masthead-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.masthead-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.masthead-nav a {
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.15s;
}

.masthead-nav a:hover {
  color: var(--ink);
}

/* Section label */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* Headlines */
.headline {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.headline-xl {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.headline-lg {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.headline-md {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Deck / subtitle */
.deck {
  font-size: 1.1rem;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 560px;
  margin-bottom: 2rem;
}

/* Rule / divider */
.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.rule-heavy {
  border-top-width: 2px;
  border-color: var(--ink);
}

/* Content column */
.content-col {
  max-width: var(--page-max);
}

/* Address generation block */
.gen-block {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  padding: 2rem;
  margin-bottom: 2rem;
}

.gen-block .section-label {
  margin-bottom: 1rem;
}

.address-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
}

.address-email {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-all;
}

.address-copy {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 0.375rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.address-copy:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.copied-toast {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-pass);
  font-weight: 500;
  margin-right: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.copied-toast.show { opacity: 1; }

.gen-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gen-reset {
  background: none;
  border: none;
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gen-reset:hover { color: var(--ink); }

/* Listening state */
.listening {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0;
}

.listening-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s infinite ease-in-out;
  flex-shrink: 0;
}

.listening-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.listening-text {
  font-size: 0.85rem;
  color: var(--ink-2);
}

.listening-timer {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

/* Report section */
.report-body {
  animation: fadeUp 0.4s ease-out;
}

.report-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.meta-cell {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rule-light);
}

.meta-cell:nth-child(odd) {
  border-right: 1px solid var(--rule-light);
}

.meta-cell:nth-last-child(-n+2) {
  border-bottom: none;
}

.meta-cell-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 0.25rem;
}

.meta-cell-value {
  font-size: 0.9rem;
  color: var(--ink);
}

.meta-cell-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Check results — stacked editorial layout */
.checks-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.check-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  padding-left: 0;
  transition: padding-left 0.2s;
}

.check-item:last-child {
  border-bottom: none;
}

.check-item.pass {
  padding-left: 0.75rem;
  border-left: 3px solid var(--color-pass);
}

.check-item.fail {
  padding-left: 0.75rem;
  border-left: 3px solid var(--color-fail);
}

.check-item.warning, .check-item.neutral {
  padding-left: 0.75rem;
  border-left: 3px solid var(--color-warn);
}

.check-label {
  padding: 1.25rem 1rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.check-label h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.check-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  width: fit-content;
}

.check-badge.pass { background: rgba(46, 204, 113, 0.15); color: var(--color-pass); border: 1px solid rgba(46, 204, 113, 0.3); }
.check-badge.fail { background: rgba(231, 76, 60, 0.15); color: var(--color-fail); border: 1px solid rgba(231, 76, 60, 0.3); }
.check-badge.warning, .check-badge.neutral { background: var(--bg-muted); color: var(--ink-3); }

.check-detail {
  padding: 1.25rem 0 1.25rem 1rem;
  border-left: 1px solid var(--rule-light);
}

.check-desc {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.check-result {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-2);
  line-height: 1.6;
  word-break: break-all;
  white-space: pre-wrap;
}

/* Blocklist expanded */
.blocklist-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  margin-top: 0.5rem;
}

.blocklist-toggle:hover { color: var(--ink); }

.blocklist-items {
  margin-top: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.78rem;
}

.blocklist-row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--rule-light);
}

.blocklist-row:last-child { border-bottom: none; }
.blocklist-row.listed { color: var(--color-fail); font-weight: 500; }
.blocklist-row.clean { color: var(--ink-3); }

/* Headers accordion */
.accordion-trigger {
  width: 100%;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}

.accordion-trigger:hover {
  background: var(--bg-soft);
}

.accordion-trigger .chevron {
  transition: transform 0.2s;
  color: var(--ink-3);
}

.accordion-trigger.open .chevron {
  transform: rotate(180deg);
}

.accordion-panel {
  border: 1px solid var(--rule);
  border-top: none;
  display: none;
}

.accordion-panel.open {
  display: block;
}

.headers-code {
  background: var(--bg-soft);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  line-height: 1.7;
  max-height: 350px;
  overflow-y: auto;
  margin: 0;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.75rem 1.25rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.download-link:hover { color: var(--ink); }

/* Tabs */
.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}

.tab-btn .tab-time {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-left: 0.25rem;
}

/* Share button */
.share-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 0.375rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.share-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Footer */
.footer {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
  margin-top: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
}

.footer-links a {
  color: var(--ink-3);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--ink-4);
}

/* Loading / error */
.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 0;
}

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

.loading-text {
  font-size: 0.85rem;
  color: var(--ink-3);
}

.error-text {
  font-size: 0.9rem;
  color: var(--color-fail);
  font-weight: 500;
}

/* Animations */
@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

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

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: block; }

/* Responsive */
@media (max-width: 640px) {
  .page { padding: 2rem 1.25rem 3rem; }
  .headline-xl { font-size: 2rem; }
  .headline-lg { font-size: 1.35rem; }
  .masthead-inner { flex-direction: column; align-items: flex-start; }
  .check-item { grid-template-columns: 1fr; }
  .check-label {
    padding: 1rem 1rem 0.5rem 0;
    flex-direction: row;
    align-items: center;
    border-bottom: none;
  }
  .check-detail {
    padding: 0 0 1.25rem 0;
    border-left: none;
    border-top: 1px solid var(--rule-light);
  }
  .report-meta-grid { grid-template-columns: 1fr; }
  .meta-cell { border-right: none !important; }
  .footer { flex-direction: column; align-items: flex-start; }
}
