/* swaap docs — same shell as swaap.finance: Montserrat, brand palette, flat surfaces.
   Prose keeps its real casing (addresses, HTTP verbs); headings and nav read lowercase. */

@font-face { font-family: "Montserrat"; src: url("/fonts/montserrat-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/montserrat-semi-bold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

/* ---------------------------------------------------------------- tokens */

:root {                                  /* default: the flashy purple, white type */
  --bg: #4a1dcb;
  --ink: #ffffff;
  --dim: #c9bdf3;                        /* 5.2:1 on the purple */
  --link: #c9bdf3;
  --lav: #beafef;
  --word: #ffffff;
  --surface: rgba(255, 255, 255, 0.08);  /* code blocks */
  --line: rgba(255, 255, 255, 0.18);     /* table rows */

  --sans: "Montserrat", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --text: 15px;
  --meta: 13px;
  --code: 12.5px;
  --measure: 40rem;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --ink: #01013d;
  --dim: #7065b6;                        /* 5.0:1 on white */
  --link: #4a1dcb;
  --lav: #aa9af0;
  --word: #4a1dcb;
  --surface: rgba(1, 1, 61, 0.05);
  --line: rgba(1, 1, 61, 0.12);
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: dark; scroll-padding-top: 1.5rem; }
:root[data-theme="light"] { color-scheme: light; }

body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--ink);
  font: 400 var(--text)/1.7 var(--sans);
  font-feature-settings: "tnum", "kern";
  -webkit-font-smoothing: antialiased;
}
main { max-width: 46rem; margin: 0 auto; padding: 3.5rem 1.25rem 4rem; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--lav); outline-offset: 3px; border-radius: 2px; }

/* ---------------------------------------------------------------- top: mark + pages */

.top { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2.75rem; }
.mark-btn { appearance: none; -webkit-appearance: none; display: block; padding: 0; margin: 0; border: 0; background: none; color: var(--ink); cursor: pointer; line-height: 0; }
.mark-btn:focus-visible { outline: 2px solid var(--lav); outline-offset: 6px; border-radius: 4px; }
.mark { display: block; transform-origin: 50% 60%; }
@media (prefers-reduced-motion: no-preference) {
  .mark-btn:hover .mark { animation: swim 1.6s ease-in-out infinite; }
  @keyframes swim { 0%,50%,100% { transform: none; } 25% { transform: translateY(-2px) rotate(-5deg); } 75% { transform: translateY(2px) rotate(5deg); } }
}
.pages { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1.1rem; font-size: var(--meta); text-transform: lowercase; }
.pages a { color: var(--dim); }
.pages .home { color: var(--ink); font-weight: 600; }
.pages .sep { color: var(--dim); margin-left: -0.6rem; margin-right: -0.6rem; }
.pages [aria-current="page"] { color: var(--ink); }

/* ---------------------------------------------------------------- prose */

.doc { max-width: var(--measure); }
.doc > :first-child { margin-top: 0; }
.doc h1, .doc h2, .doc h3, .doc h4 { text-transform: lowercase; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.doc h1 { font-size: clamp(1.8125rem, 4.2vw, 2.6625rem); letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 1.5rem; }
.doc h2 { font-size: 1.3rem; margin: 3rem 0 1rem; }
.doc h3 { font-size: 1rem; margin: 2.25rem 0 0.75rem; }
.doc h3::before {                        /* a short lavender dash marks the third level */
  content: ""; display: inline-block; width: 0.9em; height: 2px; margin-right: 0.55em;
  background: var(--lav); vertical-align: 0.28em;
}
.doc h2 + h3 { margin-top: 1.25rem; }
.doc h4 { font-size: var(--meta); font-family: var(--mono); font-weight: 400; color: var(--dim); text-transform: none; letter-spacing: 0.02em; margin: 1.5rem 0 0.5rem; }
.doc p, .doc ul, .doc ol { margin: 0 0 1rem; }
.doc ul, .doc ol { padding-left: 1.25rem; }
.doc li { margin: 0.35rem 0; }
.doc strong { font-weight: 600; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.toc { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin: -0.5rem 0 2rem; font-family: var(--mono); font-size: var(--meta); text-transform: lowercase; }
.toc a { color: var(--dim); }

/* code */
.doc code { font-family: var(--mono); font-size: var(--code); }
.doc :not(pre) > code { padding: 0.1em 0.35em; background: var(--surface); border-radius: 3px; }
.doc pre { margin: 0 0 1.25rem; padding: 0.9rem 1rem; background: var(--surface); border-radius: 4px; overflow-x: auto; line-height: 1.55; }
.doc pre code { background: none; padding: 0; white-space: pre; }

/* tables — hairlines between rows only */
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: var(--meta); }
.doc th { text-align: left; font-family: var(--mono); font-weight: 400; color: var(--dim); padding: 0.35rem 1rem 0.5rem 0; }
.doc td { padding: 0.5rem 1rem 0.5rem 0; border-top: 1px solid var(--line); vertical-align: top; }
.doc td:last-child, .doc th:last-child { padding-right: 0; font-family: var(--mono); word-break: break-all; }

/* math (MathML, rendered at build time) */
.math { margin: 0.25rem 0 1.25rem; overflow-x: auto; text-align: center; font-size: 1.15em; }
.math math { display: block; }
math { font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", serif; }

/* ---------------------------------------------------------------- footer */

footer { margin-top: 3.5rem; font-family: var(--mono); font-size: var(--meta); color: var(--dim); text-transform: lowercase; }
footer p { margin: 0; }
footer a { color: inherit; }
footer .tick { color: var(--word); display: inline-block; min-width: 5ch; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 40rem) {
  main { padding: 2.25rem 1rem 3rem; }
  .top { flex-direction: column; align-items: flex-start; gap: 1.25rem; margin-bottom: 2rem; }
  .doc pre { margin-left: -1rem; margin-right: -1rem; border-radius: 0; padding-left: 1rem; padding-right: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { a { color: inherit; } .mark-btn { display: none; } }
