/* TraceSpeed legal & help.
   Plain reading layout: one text column, quiet rules, the app blue only for
   links and focus. Dated snapshots are immutable HTML, so every page style
   lives here and must keep working for all published versions. */

:root {
  color-scheme: light dark;
  --bg: #fbfbfa;
  --text: #16181d;
  --muted: #5f6672;
  --faint: #8a909b;
  --rule: #e4e5e8;
  --tint: #f2f3f5;
  --link: #1d4ed8;
  --link-hover: #1e3a8a;
  --focus: #2563eb;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --text: #e8e9ec;
    --muted: #a2a8b3;
    --faint: #7a808b;
    --rule: #2a2e35;
    --tint: #191c21;
    --link: #8ab4ff;
    --link-hover: #b9d1ff;
    --focus: #8ab4ff;
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

/* ---------- Text ---------- */

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

h1,
h2,
h3 {
  color: var(--text);
  overflow-wrap: break-word;
  hyphens: auto;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.4em 0 0.6em;
  font-size: 1.2rem;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.005em;
  scroll-margin-top: 1.5rem;
}

h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1rem;
  font-weight: 650;
}

p {
  margin: 0 0 1em;
}

ul {
  margin: 0 0 1.2em;
  padding-left: 1.25em;
}

li {
  margin-bottom: 0.55em;
  padding-left: 0.2em;
}

li::marker {
  color: var(--faint);
}

strong {
  font-weight: 650;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.08em 0.35em;
  border-radius: 4px;
  background: var(--tint);
  overflow-wrap: anywhere;
}

/* ---------- Page frame ---------- */

.page {
  width: min(var(--measure), 100% - 2.5rem);
  margin: 0 auto;
  padding: 1.5rem 0 4.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 2.5rem;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.back::before {
  content: "\2190";
  font-size: 1.05em;
}

.back:hover {
  color: var(--text);
}

.lang {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.lang:hover {
  color: var(--text);
  background: var(--tint);
}

/* ---------- Documents ---------- */

/* Snapshots before 2026-10-16 have the back link without a top bar. */
.document > .back {
  margin-bottom: 1.75rem;
}

.updated + h2 {
  margin-top: 0.5em;
}

.updated {
  margin: 0.6rem 0 2.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Contents: a quiet box above the text; a sticky side column on wide screens. */
.toc {
  margin: 0 0 2.75rem;
  padding: 1.1rem 1.25rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 0.93rem;
  line-height: 1.45;
}

.toc h2 {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  margin: 0 0 0.55rem;
  padding: 0;
  counter-increment: toc;
  display: flex;
  gap: 0.6em;
  break-inside: avoid;
}

.toc li::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  padding-top: 0.08em;
}

.toc a {
  color: var(--text);
  text-decoration: none;
}

.toc a:hover {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: currentColor;
}

@media (min-width: 720px) {
  .toc ul {
    columns: 2;
    column-gap: 2rem;
  }
}

@media (min-width: 1120px) {
  .document:has(> .toc) {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) 15rem;
    column-gap: 4.5rem;
    justify-content: center;
    width: min(100% - 4rem, 66rem);
  }

  .document:has(> .toc) > * {
    grid-column: 1;
  }

  .document:has(> .toc) > .topbar {
    grid-column: 1 / -1;
  }

  .document:has(> .toc) > .toc {
    grid-column: 2;
    grid-row: 2 / span 400;
    align-self: start;
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    margin: 0;
    padding: 0 0 0 1.25rem;
    border: 0;
    border-left: 1px solid var(--rule);
    border-radius: 0;
    font-size: 0.875rem;
  }

  .document:has(> .toc) > .toc ul {
    columns: 1;
  }

  /* Grid items do not collapse margins. */
  .document:has(> .toc) > h2 {
    margin-top: 1.6em;
  }
}

/* Old imprint snapshots (2026-08). */
.provider-info {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

.provider-info h3 {
  margin-top: 0;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Start page ---------- */

.intro {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.mark {
  width: 3.5rem;
  height: 3.5rem;
  flex: none;
  border-radius: 0.95rem;
  display: block;
}

.app-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

.app-kind {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

.lead {
  max-width: 34rem;
  margin: 0.75rem 0 2.5rem;
  color: var(--muted);
}

.links {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.links li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--rule);
}

.links a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  padding: 1.05rem 0.25rem;
  color: var(--text);
  text-decoration: none;
}

.links a::after {
  content: "\2192";
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--faint);
  transition: transform 120ms ease, color 120ms ease;
}

.links a:hover::after {
  color: var(--link);
  transform: translateX(3px);
}

.links a:hover .link-title {
  color: var(--link);
}

.link-title {
  font-weight: 600;
}

.link-text {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.site-footer {
  margin-top: 3rem;
  color: var(--faint);
  font-size: 0.85rem;
  line-height: 1.6;
}

.site-footer p {
  margin: 0 0 0.3rem;
}

.site-footer a {
  color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  body {
    font-size: 1rem;
  }

  .page {
    width: calc(100% - 2rem);
    padding-top: 0.75rem;
  }

  .topbar {
    margin-bottom: 2rem;
  }

  .toc {
    padding: 0.95rem 1rem 0.45rem;
    font-size: 0.9rem;
  }

  .toc li {
    margin-bottom: 0.45rem;
  }
}

/* ---------- Print ---------- */

@media print {
  :root {
    --bg: #fff;
    --text: #000;
    --muted: #333;
    --link: #000;
  }

  body {
    font-size: 11pt;
  }

  .topbar,
  .toc {
    display: none;
  }

  .page {
    width: auto;
    padding: 0;
  }

  .document:has(> .toc) {
    display: block;
  }

  h2 {
    break-after: avoid;
  }
}
