/* ==========================================================================
   muddlEmail — Monolith · Keystone Hinge Product Landing Stylesheet
   Strict Zero-Inline CSP | Clean · Fast · Secure · Modern | WCAG AA/AAA
   ========================================================================== */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a0d;
  --surface: #111318;
  --surface-alt: #181b22;
  --surface-elevated: #161921;
  --border: #252833;
  --border-strong: #323746;
  --text: #fafafa;
  --text-secondary: #d4d4d8;
  --muted: #8e929f;
  --accent: #fafafa;
  --accent-hover: #e4e4e7;
  --accent-fg: #090a0d;
  --accent-soft: rgba(250, 250, 250, 0.08);
  --wm-muddl: #71717a;
  --wm-crease: #525560;
  --ok: #34d399;
  --ok-soft: rgba(16, 185, 129, 0.14);
  --ok-border: rgba(52, 211, 153, 0.32);
  --ok-text: #6ee7b7;
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --warn-border: rgba(251, 191, 36, 0.34);
  --warn-text: #fcd34d;
  --danger: #ef4444;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Geist Mono", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 9999px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-alt: #f4f4f5;
  --surface-elevated: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #090a0d;
  --text-secondary: #3f3f46;
  --muted: #71717a;
  --accent: #090a0d;
  --accent-hover: #27272a;
  --accent-fg: #fafafa;
  --accent-soft: rgba(9, 10, 13, 0.06);
  --wm-muddl: #71717a;
  --wm-crease: #a1a1aa;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --ok-text: #065f46;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #92400e;
  --danger: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--font-mono); }

code {
  font-size: 0.875em;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.sr-only {
  position: absolute;
  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;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-weight: 600;
}
.skip-link:focus { left: 12px; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand-wordmark { display: block; width: auto; height: 22px; }
.brand-wordmark .wm-muddl { fill: var(--wm-muddl); }
.brand-wordmark .wm-crease { fill: var(--wm-crease); }
.brand-wordmark .wm-primary { fill: var(--text); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 120ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn-sm { font-size: 13px; padding: 8px 14px; }
.btn-xs { font-size: 12px; padding: 5px 10px; }

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.btn:focus-visible,
.site-nav a:focus-visible,
.qs-tab:focus-visible,
.text-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hero */
.hero {
  padding: 68px 0 52px;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 40px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 5px 12px;
  margin-bottom: 18px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.ok { background: var(--ok); }

h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 4vw, 3.05rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.lead {
  margin: 0 0 26px;
  color: var(--text-secondary);
  font-size: 16.5px;
  max-width: 60ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Monolith Architecture Panel */
.monolith-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mono-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stack-diagram {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.stack-k {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stack-v {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.panel-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.mono-accent {
  font-family: var(--font-mono);
  color: var(--ok);
  font-weight: 600;
}

/* Metrics Strip */
.metrics-strip {
  margin: 44px 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.metric-cell {
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}
.metric-cell:last-child { border-right: none; }

.metric-cell dt {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric-cell dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Sections */
.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.section-alt {
  background: var(--surface);
}

.section-head {
  max-width: 68ch;
  margin-bottom: 36px;
}

.section-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 2.5vw, 2.05rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0;
  color: var(--text-secondary);
}

/* Cards */
.card-grid {
  display: grid;
  gap: 18px;
}

.card-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-alt .card {
  background: var(--bg);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card h3 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.badge-neutral {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* Public Preview Disclosure Card */
.notice-card {
  margin-top: 24px;
  background: var(--bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-md);
  padding: 22px;
}

.notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.text-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notice-actions {
  margin-top: 16px;
}

/* Protocols Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.spec-table th,
.spec-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.spec-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-alt);
}

.spec-table tbody tr:last-child td { border-bottom: none; }

.crate-strip {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crate-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}

/* Quick Start Tabs */
.qs-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.qs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.qs-tab {
  appearance: none;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.qs-tab.is-active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
  margin-bottom: -1px;
  padding-bottom: 11px;
}

.qs-panel[hidden] { display: none; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

.qs-panel pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
}

.qs-panel pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* Footer */
.site-footer {
  padding: 36px 0 44px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

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

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .card-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-cell { border-bottom: 1px solid var(--border); }
  .metric-cell:nth-child(2n) { border-right: none; }
  .metric-cell:last-child { grid-column: span 2; border-bottom: none; border-right: none; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .hero { padding: 44px 0 36px; }
  .section { padding: 52px 0; }
  .card-grid-3,
  .card-grid-2 { grid-template-columns: 1fr; }
  .metrics-strip { grid-template-columns: 1fr; }
  .metric-cell { border-right: none; }
  .metric-cell:last-child { grid-column: auto; }
}
