/* Plain, like paymentauth.org: the index in monospace, specs in the style of
   an RFC rendered to HTML. */
:root {
  --color-link: #0066cc;
  --color-text: #333;
  --color-muted: #666;
  --color-rule: #ddd;
  --color-code: #f6f6f6;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

body {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.index { font-family: var(--mono); }
body.spec { font-family: "Noto Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
.sep { color: #999; margin: 0 0.25rem; }

/* Index */
.index h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.header-links { font-size: 0.8rem; margin-top: 0; padding-bottom: 0.5rem; border-bottom: 2px solid var(--color-text); }
.intro { font-size: 0.9rem; }
.tree { font-size: 0.9rem; margin-top: 1.5rem; }
.folder { margin: 1.5rem 0 0.5rem 0; font-weight: 600; font-size: 1.15rem; }
.spec-entry { margin: 0.25rem 0; padding-left: 2rem; }
.branch { color: var(--color-muted); user-select: none; display: inline-block; width: 1.5rem; }
.spec-title { font-weight: 700; color: #000; }
a.spec-title:hover { color: var(--color-link); }
.formats { padding-left: 0.5rem; font-size: 0.7rem; font-weight: 400; color: var(--color-muted); }

/* Specs */
.trail { font-size: 0.8rem; color: var(--color-muted); margin: 0 0 2rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-rule); }
.spec h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 1rem; color: #000; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.1rem 1.5rem; margin: 0 0 2rem; font-size: 0.85rem; }
.meta dt { color: var(--color-muted); }
.meta dd { margin: 0; }
.spec h2 { font-size: 1.35rem; margin: 2.2rem 0 0.6rem; color: #000; }
.spec h3 { font-size: 1.1rem; margin: 1.6rem 0 0.5rem; color: #000; }
.spec h2, .spec h3 { scroll-margin-top: 1rem; }
.number { color: var(--color-text); font-weight: 400; margin-right: 0.25rem; }
a.number:hover { color: var(--color-link); }

.toc { margin: 0 0 2.5rem; padding: 1rem 1.25rem; border: 1px solid var(--color-rule); border-radius: 4px; }
.toc h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.toc ul { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.toc li { margin: 0.15rem 0; }
.toc .depth-3 { padding-left: 1.75rem; }
.toc .number { display: inline-block; min-width: 2.25rem; margin: 0; }
.toc a { color: var(--color-link); }

code { font-family: var(--mono); font-size: 0.88em; background: var(--color-code); padding: 0.1em 0.3em; border-radius: 3px; }
pre { font-family: var(--mono); background: var(--color-code); border: 1px solid var(--color-rule); border-radius: 4px; padding: 0.9rem 1rem; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; font-size: 0.85rem; }

table { border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--color-rule); padding: 0.4rem 0.7rem; text-align: left; vertical-align: top; }
th { background: #fafafa; }

/* Wide screens: the table of contents sits beside the text, fixed, as on
   paymentauth.org, with the section being read highlighted. */
.toc a.active { color: #000; font-weight: 700; }
@media (min-width: 1180px) {
  body.spec { max-width: 1240px; padding-right: 330px; box-sizing: border-box; }
  .spec .toc {
    position: fixed; top: 2rem; right: max(1rem, calc((100vw - 1240px) / 2 + 1rem)); width: 290px;
    max-height: calc(100vh - 4rem); overflow-y: auto; margin: 0; padding: 0 0 0 1.25rem;
    border: none; border-left: 1px solid var(--color-rule); border-radius: 0;
  }
  .spec .toc h2 { font-size: 0.85rem; font-weight: 400; color: var(--color-muted); padding-bottom: 0.5rem; border-bottom: 1px solid var(--color-rule); }
  .spec .toc ul { font-size: 0.82rem; }
  .spec .toc .depth-3 { padding-left: 1.25rem; }
  .spec .toc li a { display: flex; }
  .spec .toc .number { flex: none; }
}

@media (max-width: 600px) {
  .spec-entry { padding-left: 0.5rem; }
  .branch { display: none; }
}
