:root {
  --paper:    #FBFAF7;
  --ink:      #14171F;
  --muted:    #5B6070;
  --rule:     #D9D6CE;
  --envelope: #2F4B7C;
  --signal:   #C9660B;
  --surface:  #F2EFE8;

  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
  --font-sans: ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: ui-serif, 'Iowan Old Style', Palatino, serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}

@media (min-width: 480px) {
  body { font-size: 17px; }
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  border-left: 1px solid var(--rule);
}

@media (max-width: 360px) {
  .page { padding: 0 0.75rem 2rem; }
}

main { display: block; }

a { color: var(--envelope); }
a:not(:hover) { text-decoration-thickness: 1px; }

:focus-visible {
  outline: 2px solid var(--envelope);
  outline-offset: 2px;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* Header / footer: styled like raw mail headers */
.mail-meta { padding: 1rem 0; }
.meta-line {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.mail-nav { display: flex; flex-wrap: wrap; gap: 0.35em; align-items: baseline; }
.mail-nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
}
.mail-nav a:hover,
.mail-nav a:focus-visible { text-decoration: underline; }
footer.mail-meta { border-top: 1px solid var(--rule); margin-top: 3rem; }

/* Eyebrow labels: "postal stamps" */
.eyebrow {
  font-family: var(--font-serif);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6em 1.1em;
  border-radius: 0;
  border: 1px solid var(--envelope);
  background: var(--envelope);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--ink); border-color: var(--ink); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn-secondary:hover { background: var(--surface); }

/* Hero */
.hero { padding: 2.5rem 0 2rem; }
.slogan {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 4vw + 1rem, 2.6rem);
  line-height: 1.15;
}
.slogan-primary { display: block; color: var(--ink); font-weight: 600; }
.slogan-secondary { display: block; color: var(--muted); font-weight: 400; }
.lede { max-width: 68ch; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.transcript-section { padding: 0.5rem 0 1.5rem; }

/* Signature transcript: same OTP scenario, three ways */
.transcript { margin: 1.5rem 0 0.5rem; border: 1px solid var(--rule); background: var(--surface); }
.transcript .sr-tab {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}
.transcript-tabs {
  display: flex;
  border-bottom: 1px solid var(--rule);
}
.tab-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.65rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-label:hover { color: var(--ink); }
#tab-mcp:checked ~ .transcript-tabs label[for='tab-mcp'],
#tab-curl:checked ~ .transcript-tabs label[for='tab-curl'],
#tab-smtp:checked ~ .transcript-tabs label[for='tab-smtp'] {
  color: var(--ink);
  border-bottom-color: var(--envelope);
}
#tab-mcp:focus-visible ~ .transcript-tabs label[for='tab-mcp'],
#tab-curl:focus-visible ~ .transcript-tabs label[for='tab-curl'],
#tab-smtp:focus-visible ~ .transcript-tabs label[for='tab-smtp'] {
  outline: 2px solid var(--envelope);
  outline-offset: 2px;
}
.transcript-panel {
  display: none;
  margin: 0;
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#tab-mcp:checked ~ #panel-mcp,
#tab-curl:checked ~ #panel-curl,
#tab-smtp:checked ~ #panel-smtp { display: block; }
.signal { color: var(--signal); font-weight: 700; font-size: 1.25rem; }

/* Printing-in animation: the only motion on the page. The transcript lines
   are a fixed, static list (see ../pages/landing.js), so the per-line
   stagger is expressed here via nth-child instead of an inline style
   attribute (style="--i:...") — the global HTML CSP has no 'unsafe-inline'
   for style-src, so an inline style attribute would just be dropped by the
   browser. Covers the longest transcript panel (the SMTP wire panel, 11
   lines); any panel with fewer lines simply doesn't use the later rules. */
.transcript-panel .line {
  display: block;
  opacity: 0;
  animation: line-in 0.3s ease-out forwards;
}
.transcript-panel .line:nth-child(1)  { animation-delay: 0ms; }
.transcript-panel .line:nth-child(2)  { animation-delay: 70ms; }
.transcript-panel .line:nth-child(3)  { animation-delay: 140ms; }
.transcript-panel .line:nth-child(4)  { animation-delay: 210ms; }
.transcript-panel .line:nth-child(5)  { animation-delay: 280ms; }
.transcript-panel .line:nth-child(6)  { animation-delay: 350ms; }
.transcript-panel .line:nth-child(7)  { animation-delay: 420ms; }
.transcript-panel .line:nth-child(8)  { animation-delay: 490ms; }
.transcript-panel .line:nth-child(9)  { animation-delay: 560ms; }
.transcript-panel .line:nth-child(10) { animation-delay: 630ms; }
.transcript-panel .line:nth-child(11) { animation-delay: 700ms; }
@keyframes line-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .transcript-panel .line { animation: none; opacity: 1; }
}

/* How it works */
.steps { padding: 1rem 0; max-width: 68ch; }
.steps h2 { font-family: var(--font-mono); font-size: 1.1rem; margin: 0 0 1rem; }
.step { margin: 0 0 1.25rem; }
.step-title { font-weight: 600; }

/* Pricing */
.pricing { padding: 1rem 0 2rem; }
.pricing h2 { font-family: var(--font-mono); font-size: 1.1rem; margin: 0 0 1rem; }
.pricing-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.pricing-table caption { text-align: left; margin-bottom: 0.5rem; }
.pricing-table th,
.pricing-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule);
  vertical-align: top;
}
.pricing-table thead th { font-family: var(--font-mono); color: var(--muted); font-weight: 600; }
.pricing-table td.plan-price { font-family: var(--font-mono); }

@media (max-width: 480px) {
  .pricing-table { display: block; overflow-x: auto; }
}

/* Not found page */
.not-found { padding: 2.5rem 0; max-width: 68ch; }
.not-found h1 { font-family: var(--font-mono); font-size: 1.6rem; margin: 0.25rem 0 1rem; }

/* Docs page */
.docs-intro { padding: 2.5rem 0 0.5rem; }
.docs-intro h1 { font-family: var(--font-mono); font-size: 1.8rem; margin: 0.25rem 0 1rem; }
.docs-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}
.docs-toc a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-decoration: none;
}
.docs-toc a:hover,
.docs-toc a:focus-visible { text-decoration: underline; }

.docs-section { padding: 2rem 0; border-top: 1px solid var(--rule); }
.docs-section h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  margin: 0 0 1rem;
  scroll-margin-top: 1rem;
}
.docs-section h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  margin: 1.75rem 0 0.5rem;
  scroll-margin-top: 1rem;
}
.docs-section h3 .method { color: var(--muted); font-weight: 400; margin-right: 0.4em; }
.docs-section code { font-family: var(--font-mono); font-size: 0.9em; }

.snippet {
  margin: 0.75rem 0 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0 0 1.25rem; }
.table caption { text-align: left; margin-bottom: 0.5rem; }
.table th,
.table td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  vertical-align: top;
}
.table thead th { font-family: var(--font-mono); color: var(--muted); font-weight: 600; }
.table code { font-family: var(--font-mono); }
@media (max-width: 480px) {
  .table { display: block; overflow-x: auto; }
}

/* Sign-in / magic-link pages */
.auth-section { padding: 2.5rem 0; max-width: 68ch; }
.auth-section h1 { font-family: var(--font-mono); font-size: 1.6rem; margin: 0.25rem 0 1rem; }
.auth-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin-top: 1rem; }
.auth-form label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); display: block; margin-bottom: 0.35rem; }
.auth-form input {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55em 0.7em;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  min-width: 16rem;
}
.auth-form input:focus-visible { outline: 2px solid var(--envelope); outline-offset: 2px; }

/* Mailbox viewer */
.mailbox-filters { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin: 1rem 0 1.5rem; }
.mailbox-filters label { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); display: block; margin-bottom: 0.35rem; }
.mailbox-filters input {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5em 0.65em;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}
.mailbox-filters input:focus-visible { outline: 2px solid var(--envelope); outline-offset: 2px; }
.mailbox-pager { display: flex; gap: 1.5rem; margin-top: 1rem; font-family: var(--font-mono); font-size: 0.85rem; }
.mailbox-pager span { color: var(--muted); }
.mailbox-signal { color: var(--signal); font-weight: 600; }
.mailbox-meta { margin: 1.5rem 0; }
.mailbox-frame { display: block; width: 100%; height: 60vh; border: 1px solid var(--rule); background: var(--paper); margin: 1.5rem 0; }
.mailbox-attachments { list-style: none; padding: 0; margin: 0; }
.mailbox-attachments li { font-family: var(--font-mono); font-size: 0.85rem; padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }

/* Developer cabinet */
.cabinet-intro { padding: 2.5rem 0 0.5rem; }
.cabinet-intro h1 { font-family: var(--font-mono); font-size: 1.8rem; margin: 0.25rem 0 1rem; }
.cabinet-section { padding: 2rem 0; border-top: 1px solid var(--rule); }
.cabinet-section h2 { font-family: var(--font-mono); font-size: 1.3rem; margin: 0 0 1rem; }
.cabinet-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.cabinet-actions form { margin: 0; }
