/* Madagascar Email API: documentation styles.
   Airmail as the one bold idea (the stripe and the postmark); everything else quiet. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque-v9-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-v26-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-v26-latin-italic.woff2') format('woff2');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Spline Sans Mono';
  src: url('/fonts/spline-sans-mono-v13-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #f5f8f7;
  --surface: #ffffff;
  --sunk: #ebf1ef;
  --code-bg: #eef3f1;
  --line: #d6dfdc;
  --line-strong: #b3c2be;
  --ink: #13232b;
  --ink-2: #48595f;
  --ink-3: #6a7b80;
  --teal: #0a6b62;
  --teal-brand: #0d9488;
  --teal-wash: #def1ed;
  --red: #bd3326;
  --red-wash: #fae8e5;
  --navy: #213f78;
  --navy-wash: #e6ebf6;
  --ochre: #8c5f0e;
  --ochre-wash: #f7eedb;
  --on-teal: #ffffff;
  --shadow: 0 1px 0 rgb(19 35 43 / 0.04), 0 12px 32px -12px rgb(19 35 43 / 0.18);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --font-text: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;

  --header-h: 3.75rem;
  --radius: 10px;
  --measure: 44rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0e1a1f;
    --surface: #13232a;
    --sunk: #0b161a;
    --code-bg: #0a1519;
    --line: #233540;
    --line-strong: #345059;
    --ink: #e3ece9;
    --ink-2: #a9bab7;
    --ink-3: #82959a;
    --teal: #63d6c6;
    --teal-brand: #2cc1ae;
    --teal-wash: #11312d;
    --red: #ff8273;
    --red-wash: #3a1e1b;
    --navy: #a5bcf0;
    --navy-wash: #172540;
    --ochre: #eab95e;
    --ochre-wash: #33270f;
    --on-teal: #062420;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 16px 40px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #0e1a1f;
  --surface: #13232a;
  --sunk: #0b161a;
  --code-bg: #0a1519;
  --line: #233540;
  --line-strong: #345059;
  --ink: #e3ece9;
  --ink-2: #a9bab7;
  --ink-3: #82959a;
  --teal: #63d6c6;
  --teal-brand: #2cc1ae;
  --teal-wash: #11312d;
  --red: #ff8273;
  --red-wash: #3a1e1b;
  --navy: #a5bcf0;
  --navy-wash: #172540;
  --ochre: #eab95e;
  --ochre-wash: #33270f;
  --on-teal: #062420;
  --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 16px 40px -16px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 160ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1.25rem);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.125rem;
  line-height: 1.62;
  font-optical-sizing: auto;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 3px;
}
::selection {
  background: var(--teal-wash);
  color: var(--ink);
}

code,
kbd,
pre {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  border-radius: 6px;
}
.skip:focus {
  top: 1rem;
}

/* ─── The airmail stripe: the brand edge on every page ───────────────────── */

.airmail {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 12px,
    transparent 12px 18px,
    var(--navy) 18px 30px,
    transparent 30px 36px
  );
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: var(--header-h);
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.mark {
  width: 2rem;
  height: 2rem;
  color: var(--teal-brand);
  flex: none;
}
.brand-name {
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-weight: 450;
  color: var(--ink-2);
}
.top-nav {
  display: flex;
  gap: 1.5rem;
}
.top-nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.top-nav a:hover {
  color: var(--ink);
}
.top-nav a[aria-current] {
  color: var(--ink);
  border-bottom-color: var(--teal-brand);
}
.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-open {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 13rem;
  height: 2.25rem;
  padding: 0 0.6rem 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.search-open:hover {
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.search-open svg,
.icon-button svg {
  width: 1.1rem;
  height: 1.1rem;
}
.search-kbd {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--paper);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-button:hover {
  border-color: var(--line);
  color: var(--ink);
}
.menu-button {
  display: none;
}

/* ─── Docs shell ──────────────────────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 15.5rem minmax(0, 1fr) 13.5rem;
  gap: clamp(1.5rem, 3vw, 3.5rem);
  max-width: 92rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 2rem 0.5rem 3rem 0;
  font-family: var(--font-display);
  scrollbar-width: thin;
}
.nav-group + .nav-group {
  margin-top: 1.6rem;
}
.nav-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.85rem;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.93rem;
  line-height: 1.35;
}
.sidebar a:hover {
  color: var(--ink);
  border-left-color: var(--line-strong);
}
.sidebar a[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--teal-brand);
}

.content {
  min-width: 0;
  padding: 2.5rem 0 4rem;
}

.toc {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 2.6rem 0 2rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
}
.toc-title {
  margin: 0 0 0.6rem;
  font-weight: 650;
  color: var(--ink-3);
  font-size: 0.8rem;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc a {
  display: block;
  padding: 0.22rem 0 0.22rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--ink-3);
  text-decoration: none;
  line-height: 1.35;
}
.toc .toc-l3 a {
  padding-left: 1.5rem;
}
.toc a:hover {
  color: var(--ink);
}
.toc a.is-active {
  color: var(--ink);
  border-left-color: var(--teal-brand);
}

/* ─── Prose ───────────────────────────────────────────────────────────────── */

.prose {
  max-width: var(--measure);
}
.page-head {
  margin-bottom: 2.25rem;
}
.page-section {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal);
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 720;
  font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.lead {
  margin: 1rem 0 0;
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

:where(.prose) h2,
:where(.prose) h3,
:where(.prose) h4 {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
:where(.prose) h2 {
  margin: 2.8rem 0 0.9rem;
  font-size: 1.6rem;
  font-weight: 680;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
:where(.prose) h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.22rem;
  font-weight: 650;
}
:where(.prose) h4 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 650;
}
:where(.prose) :is(h2, h3, h4) > .anchor {
  margin-left: 0.4rem;
  color: var(--line-strong);
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
}
:where(.prose) :is(h2, h3, h4):hover > .anchor,
:where(.prose) .anchor:focus-visible {
  opacity: 1;
}
:where(.prose) p,
:where(.prose) ul,
:where(.prose) ol {
  margin: 0 0 1.05rem;
  text-wrap: pretty;
}
:where(.prose) ul,
:where(.prose) ol {
  padding-left: 1.3rem;
}
:where(.prose) li {
  margin: 0.3rem 0;
  padding-left: 0.2rem;
}
:where(.prose) li::marker {
  color: var(--ink-3);
}
:where(.prose) strong {
  font-weight: 650;
}
:where(.prose) :not(pre) > code {
  font-size: 0.82em;
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--sunk);
  border: 1px solid var(--line);
  white-space: nowrap;
}
:where(.prose) a.ext::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-left: 0.2em;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: translateY(-0.1em);
  opacity: 0.6;
}
.page-updated {
  margin-top: 3rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ─── Tables ──────────────────────────────────────────────────────────────── */

.table-wrap {
  margin: 1.2rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}
th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-2);
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--sunk);
  white-space: nowrap;
}
td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
tr:last-child td {
  border-bottom: 0;
}
td code {
  white-space: nowrap;
}

/* ─── Code ────────────────────────────────────────────────────────────────── */

.code {
  margin: 1.2rem 0 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0.5rem 0.35rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--ink-3);
}
.copy {
  font: inherit;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.copy:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.copy[data-state='done'] {
  color: var(--teal);
  border-color: var(--teal);
}
.code pre {
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
  tab-size: 2;
}
.t-key { color: var(--ink); font-weight: 500; }
.t-string { color: var(--teal); }
.t-number { color: var(--ochre); }
.t-literal { color: var(--red); }
.t-keyword { color: var(--navy); font-weight: 600; }
.t-attr { color: var(--navy); }
.t-flag { color: var(--navy); }
.t-var { color: var(--ochre); }
.t-type { color: var(--teal-brand); }
.t-comment { color: var(--ink-3); }
.t-punct { color: var(--ink-3); }

.tabs {
  margin: 1.2rem 0 1.6rem;
}
.tablist {
  display: flex;
  gap: 0.15rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  scrollbar-width: none;
}
.tablist button {
  flex: none;
  padding: 0.5rem 0.8rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-3);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.tablist button:hover {
  color: var(--ink);
}
.tablist button[aria-selected='true'] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--teal-brand);
}
.tabs .code {
  margin-top: 0.6rem;
  margin-bottom: 0;
}

/* ─── Callouts ────────────────────────────────────────────────────────────── */

.callout {
  margin: 1.4rem 0;
  padding: 0.9rem 1.1rem 0.2rem;
  border-left: 3px solid var(--navy);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--navy-wash);
}
.callout-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--navy);
}
.callout-warn {
  border-left-color: var(--ochre);
  background: var(--ochre-wash);
}
.callout-warn .callout-title {
  color: var(--ochre);
}
.callout-danger {
  border-left-color: var(--red);
  background: var(--red-wash);
}
.callout-danger .callout-title {
  color: var(--red);
}
.callout p {
  font-size: 1.02rem;
}

/* ─── Endpoint, HTTP status, message status ───────────────────────────────── */

.endpoint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 1.2rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.method {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  color: var(--navy);
  background: var(--navy-wash);
}
.method-post {
  color: var(--teal);
  background: var(--teal-wash);
}
.method-delete {
  color: var(--red);
  background: var(--red-wash);
}
.endpoint .endpoint-path {
  font-size: 0.98rem;
  font-weight: 500;
  padding: 0;
  border: 0;
  background: none;
}
.endpoint-needs {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--ink-3);
}

.http {
  font-family: var(--font-mono);
  font-size: 0.82em;
  font-weight: 600;
  padding: 0.08em 0.4em;
  border-radius: 4px;
  white-space: nowrap;
}
.http-2xx { color: var(--teal); background: var(--teal-wash); }
.http-4xx { color: var(--ochre); background: var(--ochre-wash); }
.http-5xx { color: var(--red); background: var(--red-wash); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.82em;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.pill-ring {
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  border: 2px solid currentColor;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px currentColor;
}
.pill-sent { color: var(--teal); }
.pill-retrying { color: var(--ochre); }
.pill-failed { color: var(--red); }
.pill-dead { color: var(--ink-3); }

/* ─── Facts, steps, link lists, pager ─────────────────────────────────────── */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 1.5rem;
  margin: 1.4rem 0 1.8rem;
}
.facts > div {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line-strong);
}
.facts dt {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-2);
}
.facts dd {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.facts-note {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-text);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-3);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 1.5rem 0 2rem;
  padding: 0;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.2rem 3.4rem;
  margin: 0;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 2px solid var(--teal-brand);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--teal);
  background: var(--paper);
}
.steps > li::after {
  content: '';
  position: absolute;
  left: calc(1.15rem - 1px);
  top: 2.6rem;
  bottom: 0.2rem;
  border-left: 2px dashed var(--line-strong);
}
.steps > li:last-child::after {
  display: none;
}
.steps > li > h3 {
  margin: 0.25rem 0 0.6rem;
  padding: 0;
  border: 0;
}

.linklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0 2.5rem;
}
.linklist li {
  border-top: 1px solid var(--line);
}
.linklist a {
  display: block;
  padding: 1rem 0 1.1rem;
  color: var(--ink);
  text-decoration: none;
}
.linklist-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}
.linklist a:hover .linklist-title {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.linklist-text {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.5;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: var(--measure);
  margin-top: 3rem;
  font-family: var(--font-display);
}
.pager a {
  display: block;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}
.pager a:hover {
  border-color: var(--teal-brand);
}
.pager-next {
  text-align: right;
}
.pager-label {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-3);
}
.pager-title {
  font-weight: 600;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.9rem;
  padding: 0 1.25rem;
  border-radius: 9px;
  border: 1.5px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1rem;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
.button:hover {
  background: var(--surface);
}
.button-primary {
  color: var(--on-teal);
  background: var(--teal);
  border-color: var(--teal);
}
.button-primary:hover {
  background: color-mix(in srgb, var(--teal) 88%, var(--ink));
}
.button-small {
  height: 2.3rem;
  padding: 0 0.9rem;
  font-size: 0.9rem;
}

/* ─── Home ────────────────────────────────────────────────────────────────── */

.home main {
  overflow-x: clip;
}
.wrap {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-top: clamp(3rem, 7vw, 6rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 760;
  font-size: clamp(2.7rem, 1.6rem + 4.4vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.hero-lead {
  margin: 1.4rem 0 2rem;
  max-width: 34ch;
  font-size: 1.32rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero-note {
  margin: 1.4rem 0 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink-3);
}

/* The envelope: an airmail border around a request and its receipt. */
.envelope {
  position: relative;
  padding: 9px;
  border-radius: 14px;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 14px,
    var(--surface) 14px 21px,
    var(--navy) 21px 35px,
    var(--surface) 35px 42px
  );
  box-shadow: var(--shadow);
  transform: rotate(0.6deg);
}
.envelope-inner {
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.envelope-side {
  padding: 1.1rem 1.25rem 1.2rem;
}
.envelope-side + .envelope-side {
  border-top: 2px dashed var(--line-strong);
  background: var(--sunk);
}
.envelope-label {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-3);
}
.envelope pre {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.postmark {
  position: absolute;
  top: -1.6rem;
  right: -1.2rem;
  width: 8.4rem;
  height: 8.4rem;
  color: var(--teal-brand);
  transform: rotate(-14deg);
  animation: stamp 700ms cubic-bezier(0.2, 0.9, 0.25, 1.15) 450ms both;
  pointer-events: none;
}
.postmark text {
  font-family: var(--font-display);
  font-weight: 700;
  fill: currentColor;
}
@keyframes stamp {
  0% {
    opacity: 0;
    transform: rotate(-4deg) scale(1.6);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0.92;
    transform: rotate(-14deg) scale(1);
  }
}

.band {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-top: 1px solid var(--line);
}
.band h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.band-intro {
  margin: 0 0 2rem;
  max-width: 60ch;
  color: var(--ink-2);
  font-size: 1.15rem;
}

/* The route: the real sequence a message goes through. */
.route {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  counter-reset: hop;
}
.route li {
  position: relative;
  counter-increment: hop;
  padding-top: 3.4rem;
}
.route li::before {
  content: counter(hop);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 2px solid var(--teal-brand);
  background: var(--paper);
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 700;
  z-index: 1;
}
.route li::after {
  content: '';
  position: absolute;
  top: 1.2rem;
  left: 2.4rem;
  right: -1.5rem;
  border-top: 2px dashed var(--line-strong);
}
.route li:last-child::after {
  display: none;
}
.route h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 650;
}
.route p {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-2);
  line-height: 1.5;
}
/* The route inside a docs page: always vertical, it lives in a narrow column. */
.route-compact {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 1.2rem 0 1.8rem;
}
.route-compact li {
  padding: 0 0 1.1rem 3.4rem;
}
.route-compact li::after {
  top: 2.6rem;
  bottom: 0.2rem;
  left: calc(1.2rem - 1px);
  right: auto;
  border-top: 0;
  border-left: 2px dashed var(--line-strong);
}
.route-compact h3 {
  margin: 0.35rem 0 0.2rem;
  padding: 0;
  border: 0;
  font-size: 1.08rem;
}
.route-time {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-3);
}

.promises {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 3rem;
  margin: 0;
}
.promises > div {
  padding: 1.1rem 0 1.2rem;
  border-top: 1px solid var(--line-strong);
}
.promises dt {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.promises dd {
  margin: 0.3rem 0 0;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.55;
}

/* ─── Live check (ping) ───────────────────────────────────────────────────── */

.ping {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1rem;
  margin: 1.2rem 0 1.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 0.95rem;
}
.ping-result {
  color: var(--ink-2);
}
.ping-result[data-state='ok'] {
  color: var(--teal);
}
.ping-result[data-state='error'] {
  color: var(--red);
}

/* ─── Search ──────────────────────────────────────────────────────────────── */

.search {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(34rem, 80vh);
  margin: 10vh auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search::backdrop {
  background: rgb(10 20 25 / 0.45);
  backdrop-filter: blur(2px);
}
.search-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
}
.search-form svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
}
.search-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.search-close {
  font-family: var(--font-display);
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink-3);
  cursor: pointer;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  max-height: calc(min(34rem, 80vh) - 3.6rem);
  overflow-y: auto;
}
.search-results a {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.search-results li[aria-selected='true'] a,
.search-results a:hover {
  background: var(--teal-wash);
}
.search-hit-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
}
.search-hit-where {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--ink-3);
}
.search-hit-text {
  display: block;
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.45;
}
.search-results mark {
  background: transparent;
  color: var(--teal);
  font-weight: 650;
}
.search-empty {
  margin: 0;
  padding: 1rem 1.2rem 1.3rem;
  color: var(--ink-2);
  font-size: 1rem;
}

/* ─── Request builder ─────────────────────────────────────────────────────── */

.builder {
  display: grid;
  gap: 1rem;
  margin: 1.4rem 0 2rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--font-display);
}
.builder-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.field-hint {
  display: block;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 0.8rem;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.field textarea {
  min-height: 2.7rem;
  resize: vertical;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 0;
  border-color: var(--teal);
}
.field[data-invalid] input,
.field[data-invalid] textarea {
  border-color: var(--red);
}
.field-error {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--red);
}
.builder-status {
  margin: 0;
  font-size: 0.95rem;
}
.builder-status[data-state='ok'] {
  color: var(--teal);
}
.builder-status[data-state='error'] {
  color: var(--red);
}
.token-result {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
}
.token-result[data-state='ok'] {
  color: var(--teal);
}
.token-result[data-state='error'] {
  color: var(--red);
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  background: var(--sunk);
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--ink-2);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem 3rem;
  max-width: 92rem;
  margin: 0 auto;
  padding: 2.5rem clamp(1rem, 3vw, 2rem) 1.5rem;
}
.footer-brand {
  display: flex;
  gap: 0.9rem;
  max-width: 38rem;
}
.footer-brand .mark {
  width: 2.4rem;
  height: 2.4rem;
}
.footer-brand p {
  margin: 0 0 0.35rem;
  line-height: 1.5;
}
.footer-name {
  font-weight: 700;
  color: var(--ink);
}
.footer-links {
  display: flex;
  gap: 3rem;
}
.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links li {
  margin: 0 0 0.45rem;
}
.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.footer-fine {
  max-width: 92rem;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem) 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* ─── 404 ─────────────────────────────────────────────────────────────────── */

.notfound {
  max-width: 40rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
}
.notfound h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.4rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 1rem 0;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 14.5rem minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .top-nav,
  .search-kbd,
  .search-open-text {
    display: none;
  }
  .search-open {
    min-width: 0;
    width: 2.25rem;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
  }
  .menu-button {
    display: grid;
  }
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: calc(var(--header-h) + 6px);
    left: 0;
    bottom: 0;
    z-index: 30;
    width: min(20rem, 86vw);
    max-height: none;
    padding: 1.5rem 1.25rem 3rem;
    background: var(--paper);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 200ms ease;
    visibility: hidden;
  }
  .sidebar[data-open] {
    transform: none;
    visibility: visible;
  }
  .content {
    padding-top: 1.8rem;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .envelope {
    margin-right: 0.8rem;
  }
  .route {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .route li {
    padding: 0 0 1.5rem 3.4rem;
  }
  .route li::after {
    top: 2.6rem;
    bottom: 0.2rem;
    left: calc(1.2rem - 1px);
    right: auto;
    border-top: 0;
    border-left: 2px dashed var(--line-strong);
  }
  .promises {
    grid-template-columns: minmax(0, 1fr);
  }
  .builder-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .footer-links {
    gap: 2rem;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1.0625rem;
  }
  .brand-sub {
    display: none;
  }
  .pager {
    grid-template-columns: minmax(0, 1fr);
  }
  .postmark {
    width: 6.6rem;
    height: 6.6rem;
    top: -1.4rem;
    right: -0.9rem;
  }
  .endpoint-needs {
    margin-left: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}

@media print {
  .airmail,
  .site-header,
  .sidebar,
  .toc,
  .pager,
  .site-footer,
  .copy,
  .search {
    display: none !important;
  }
  .shell {
    display: block;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .code,
  .table-wrap {
    break-inside: avoid;
  }
}

/* ─── Small additions: table notes, filter, 404 mark ─────────────────────── */

.cell-note {
  display: inline-block;
  margin-top: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--ink-3);
}
.filter {
  max-width: 22rem;
  margin: 1rem 0 0.4rem;
  font-family: var(--font-display);
}
.notfound-mark {
  width: 4.5rem;
  height: 4.5rem;
  transform: rotate(-10deg);
}
tr[hidden] {
  display: none;
}

/* About this email (/about/): the recipient's page, filled in by about.js. */
.about [hidden],
.about-report[hidden] {
  display: none;
}
.about-status {
  margin: 0.4rem 0 0;
  color: var(--ink-2);
}
.about-facts dd {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.about-report {
  margin: 1rem 0 1.6rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.about-reasons {
  display: grid;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  padding: 0;
  border: 0;
}
.about-reasons legend {
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.about-reasons label {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  min-height: 2.75rem;
}
.about-result {
  margin: 0;
}
.about-result[data-state='ok'] {
  color: var(--teal);
}
.about-result[data-state='error'] {
  color: var(--red);
}

/* ─── Send a test email (/test/) ──────────────────────────────────────────── */

.tester-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.tester-actions-end {
  align-self: end;
}
.tester-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 0.95rem;
}
.tester-choice legend {
  width: 100%;
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.tester-choice label {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.tester-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.92rem;
}
.tester-facts dt {
  color: var(--ink-3);
}
.tester-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.tester-empty {
  margin: 0;
  color: var(--ink-2);
}
.tester-out {
  margin: 0;
  max-height: 28rem;
  overflow: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
