/* HarnessXML.com
   Copyright 2026 VisML. SPDX-License-Identifier: Apache-2.0

   Design system inherited verbatim from visml.com — same custom-property names,
   same palette values, same type pairing, same dark-first behaviour. The two
   sites should read as one house.

   visml.com is a landing page; this is a specification site. So the tokens are
   copied exactly and then EXTENDED to the components visml.com has no need for:
   sidebar navigation, on-page contents, prose tables, code blocks, callouts,
   search. Where a new component is invented it follows the same rules — square
   corners, 1px --line borders, monospace for anything structural, serif for
   anything you actually read.

   Palette contrast is AA in both themes: --text and --signal exceed 7:1 on
   --ground, --muted clears 4.5:1.
*/

:root {
  color-scheme: dark light;

  /* ---- visml.com tokens, verbatim (dark is the default) ---- */
  --ground: #0a1215;
  --surface: #101b20;
  --raised: #17242a;
  --line: #22343b;
  --text: #e8edec;
  --muted: #6d8892;
  --structure: #7fb8c4;
  --signal: #f0b04e;
  --signal-soft: #f4bd6a;

  --display: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --body: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);

  /* ---- docs-only additions, in the same spirit ---- */
  --sidebar-w: 17.5rem;
  --toc-w: 15rem;
  --header-h: 3.75rem;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #f2f6f5; --surface: #e9f0ef; --raised: #ffffff; --line: #cfdcdb;
    --text: #0c1316; --muted: #516b73;
    --structure: #2c6a7a; --signal: #a86a10; --signal-soft: #8f5a0a;
  }
}

:root[data-theme="light"] {
  --ground: #f2f6f5; --surface: #e9f0ef; --raised: #ffffff; --line: #cfdcdb;
  --text: #0c1316; --muted: #516b73;
  --structure: #2c6a7a; --signal: #a86a10; --signal-soft: #8f5a0a;
}

:root[data-theme="dark"] {
  --ground: #0a1215; --surface: #101b20; --raised: #17242a; --line: #22343b;
  --text: #e8edec; --muted: #6d8892;
  --structure: #7fb8c4; --signal: #f0b04e; --signal-soft: #f4bd6a;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--body);
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }
::selection { background: var(--signal); color: var(--ground); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- accessibility ---------- */

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--signal); color: var(--ground);
  padding: .8rem 1.4rem; font-family: var(--display);
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- masthead ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: 1.5rem;
  max-width: 100rem; margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The visml.com mark, adapted: structural half in --text, the thing that makes
   it a format in --signal. Same letterspacing, same uppercase treatment. */
.brand {
  font-family: var(--display); font-weight: 700; font-size: .95rem;
  letter-spacing: .3em; text-transform: uppercase; text-decoration: none;
  white-space: nowrap;
}
.brand .b-harness { color: var(--text); }
.brand .b-xml { color: var(--signal); }
.brand-mark { display: none; }

.header-search { position: relative; flex: 1; max-width: 28rem; }
.header-search input {
  width: 100%; padding: .5rem .75rem;
  font-family: var(--display); font-size: .8rem; letter-spacing: .04em;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 0;
}
.header-search input::placeholder { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; }
.header-search input:focus { border-color: var(--structure); }

.search-results {
  position: absolute; top: calc(100% + .5rem); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  max-height: min(70vh, 34rem); overflow-y: auto; z-index: 120;
}
.search-results a {
  display: block; padding: .7rem .9rem; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--raised); }
.search-results a:hover .r-title, .search-results a.active .r-title { color: var(--signal); }
.search-results .r-section {
  font-family: var(--display); font-size: .64rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
}
.search-results .r-title { font-family: var(--display); font-weight: 700; font-size: .9rem; margin-top: .1rem; }
.search-results .r-snippet { font-size: .84rem; color: var(--muted); margin-top: .2rem; line-height: 1.5; }
.search-results .r-empty {
  padding: 1rem; color: var(--muted); font-family: var(--display);
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
}

.header-links {
  display: flex; gap: 1.6rem;
  font-family: var(--display); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
}
.header-links a { color: var(--muted); text-decoration: none; transition: color .2s; }
.header-links a:hover { color: var(--signal); }

.theme-toggle, .nav-toggle {
  background: transparent; border: 1px solid var(--line); border-radius: 0;
  color: var(--muted); width: 2.2rem; height: 2.2rem; cursor: pointer;
  font-size: .95rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s;
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--signal); border-color: var(--signal); }
.nav-toggle { display: none; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 3rem;
  max-width: 100rem; margin-inline: auto;
  padding-inline: var(--gutter);
  align-items: start;
}

.sidebar {
  position: sticky; top: var(--header-h);
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 2rem 1rem 4rem 0;
  border-right: 1px solid var(--line);
}

.sidebar-nav details { margin-bottom: .25rem; }
.sidebar-nav summary {
  cursor: pointer; list-style: none;
  font-family: var(--display); font-size: .68rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  padding: .5rem 0; transition: color .2s;
}
.sidebar-nav summary::-webkit-details-marker { display: none; }
.sidebar-nav summary::before { content: "+ "; color: var(--structure); }
.sidebar-nav details[open] > summary::before { content: "– "; }
.sidebar-nav summary:hover { color: var(--text); }

.sidebar-nav ul { list-style: none; margin: 0 0 1rem; padding: 0 0 0 .1rem; }
.sidebar-nav li a {
  display: block; padding: .32rem 0 .32rem .85rem;
  font-family: var(--display); font-size: .78rem; line-height: 1.45;
  color: var(--muted); text-decoration: none;
  border-left: 1px solid var(--line);
  transition: color .2s, border-color .2s;
}
.sidebar-nav li a:hover { color: var(--text); border-left-color: var(--structure); }
.sidebar-nav li a[aria-current="page"] {
  color: var(--signal); border-left-color: var(--signal); font-weight: 700;
}

.badge {
  display: inline-block; margin-left: .45rem; padding: 0 .3rem;
  font-family: var(--display); font-size: .58rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle;
}
.badge-draft { color: var(--structure); border-color: var(--structure); }
.badge-planned { color: var(--muted); }

.version-select { padding: 2rem 1rem .5rem 0; }
.version-select label {
  display: block; font-family: var(--display); font-size: .64rem;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .4rem;
}
.version-select select {
  width: 100%; padding: .4rem .5rem; border-radius: 0;
  font-family: var(--display); font-size: .78rem;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
}

.content { min-width: 0; padding: 2.5rem 0 6rem; max-width: var(--measure); }

.toc {
  position: sticky; top: calc(var(--header-h) + 1.5rem);
  max-height: calc(100vh - var(--header-h) - 3rem); overflow-y: auto;
  padding: 2.5rem 0 4rem;
}
.toc-title {
  font-family: var(--display); font-size: .64rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 .75rem;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a {
  display: block; padding: .25rem 0 .25rem .85rem; margin-left: -1px;
  font-family: var(--display); font-size: .74rem; line-height: 1.45;
  color: var(--muted); text-decoration: none;
  border-left: 1px solid transparent; transition: color .2s;
}
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--signal); border-left-color: var(--signal); }
.toc-l3 a { padding-left: 1.7rem; font-size: .7rem; }

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

/* Headings are monospace, per visml.com. It is the single most recognisable
   thing about the house style. */
.content h1, .content h2, .content h3, .content h4 {
  font-family: var(--display); font-weight: 700;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.content h1 {
  font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem);
  line-height: 1.04; letter-spacing: -.035em; margin: 0 0 1rem;
}
.content h2 {
  font-size: clamp(1.35rem, 1.2rem + .8vw, 1.85rem);
  letter-spacing: -.02em; line-height: 1.15;
  margin: 3.5rem 0 1rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.content h3 { font-size: 1.12rem; letter-spacing: -.01em; margin: 2.25rem 0 .6rem; }
.content h4 {
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin: 1.75rem 0 .5rem;
}

.anchor {
  margin-left: .5rem; color: var(--structure); text-decoration: none;
  opacity: 0; font-weight: 400; transition: opacity .15s;
}
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor,
.anchor:focus-visible { opacity: 1; }

.content p { margin: 0 0 1.15rem; }
.content a { color: var(--structure); text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.content a:hover { color: var(--signal); }

.content ul, .content ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.content li { margin: .35rem 0; }
.content li::marker { color: var(--structure); }
.content li > ul, .content li > ol { margin: .35rem 0; }
.content strong { font-weight: 700; color: var(--text); }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

.content code {
  font-family: var(--display); font-size: .84em;
  background: var(--surface); border: 1px solid var(--line);
  padding: .08em .35em; overflow-wrap: break-word;
}

.code-block { position: relative; margin: 0 0 1.5rem; }
.code-block pre {
  margin: 0; padding: 1.15rem 1.25rem; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--display); font-size: .82rem; line-height: 1.6;
}
.code-block pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.code-lang {
  position: absolute; top: 0; right: 0;
  font-family: var(--display); font-size: .6rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
  padding: .35rem .6rem; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  pointer-events: none;
}

/* Wide content scrolls inside its own box; the page body never scrolls sideways. */
.table-wrap { overflow-x: auto; margin: 0 0 1.6rem; border: 1px solid var(--line); }
.content table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.content th, .content td {
  padding: .6rem .85rem; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.content th {
  background: var(--surface); font-family: var(--display);
  font-size: .68rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.content tbody tr:last-child td { border-bottom: 0; }
.content tbody tr:hover { background: var(--surface); }

/* The hairline-divider treatment from visml.com's .rail */
.callout {
  margin: 0 0 1.5rem; padding: 1rem 1.25rem;
  background: var(--surface); border-left: 2px solid var(--structure);
}
.callout > :last-child { margin-bottom: 0; }
.callout.warning { border-left-color: var(--signal); }

.banner {
  margin: 0 0 2rem; padding: .9rem 1.25rem;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--display); font-size: .78rem; line-height: 1.6; color: var(--muted);
}
.banner strong { font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.banner-draft { border-left: 2px solid var(--structure); }
.banner-draft strong { color: var(--structure); }
.banner-planned { border-left: 2px solid var(--muted); }

.content img { max-width: 100%; height: auto; }
.content figure { margin: 0 0 1.75rem; }
.content figcaption { font-family: var(--display); font-size: .74rem; color: var(--muted); margin-top: .6rem; }

/* ---------- home ---------- */

.mission {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.05rem, .9rem + .9vw, 1.5rem);
  line-height: 1.3; letter-spacing: -.02em; text-wrap: balance;
  color: var(--text);
  border-left: 2px solid var(--signal); padding-left: 1.25rem;
  margin: 1.75rem 0 2.25rem;
}

.cta-row { display: flex; gap: .75rem; flex-wrap: wrap; margin: 2rem 0 3rem; }
.cta {
  font-family: var(--display); font-size: .76rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  padding: .85rem 1.5rem; border: 1px solid var(--line);
  transition: background .2s, color .2s, border-color .2s;
}
.cta-primary { background: var(--signal); border-color: var(--signal); color: var(--ground); }
.cta-primary:hover { background: var(--signal-soft); border-color: var(--signal-soft); color: var(--ground); }
.cta-secondary { color: var(--muted); }
.cta-secondary:hover { color: var(--text); border-color: var(--structure); }

/* visml.com's .rail: a 1px grid gap over --line, so cells are separated by
   hairlines rather than by gutters. */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  margin: 2rem 0 2.5rem;
}
.card {
  background: var(--surface); padding: clamp(1.25rem, 2.5vw, 1.85rem);
  display: flex; flex-direction: column; gap: .6rem;
  transition: background .25s;
}
.card:hover { background: var(--raised); }
.card h3 {
  font-family: var(--display); font-size: .95rem; font-weight: 700;
  letter-spacing: -.01em; margin: 0; line-height: 1.3;
}
.card:hover h3 { color: var(--signal); }
.card p { margin: 0; font-size: .92rem; color: var(--muted); }

/* ---------- diagrams ---------- */

.diagram { margin: 2rem 0; overflow-x: auto; }
.diagram svg { display: block; min-width: 34rem; max-width: 100%; height: auto; color: var(--structure); }
.diagram text { font-family: var(--display); fill: var(--text); }

/* ---------- pager + footer ---------- */

.pager-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  margin: 4rem 0 2.5rem;
}
.pager {
  background: var(--surface); padding: 1rem 1.25rem;
  text-decoration: none; font-family: var(--display); font-size: .85rem; font-weight: 700;
  transition: background .25s, color .2s;
}
.pager:hover { background: var(--raised); color: var(--signal); }
.pager span {
  display: block; font-size: .62rem; font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .3rem;
}
.pager.next { text-align: right; }

.page-footer {
  margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
  font-family: var(--display); font-size: .74rem; line-height: 1.7;
  letter-spacing: .03em; color: var(--muted);
}
.page-footer p { margin: 0 0 .6rem; }
/* Footer links were --muted, identical to the surrounding text, so they did not
   read as links at all — the VisML attribution in particular looked like plain
   prose. --structure separates them from body text while staying quieter than
   --signal, which is reserved for the active/hover state. */
.page-footer a {
  color: var(--structure);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color .2s;
}
.page-footer a:hover, .page-footer a:focus-visible { color: var(--signal); }

/* ---------- responsive ---------- */

@media (max-width: 82rem) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 58rem) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .nav-toggle { display: inline-flex; }
  .header-links { display: none; }
  .sidebar {
    display: none; position: static; max-height: none;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 1rem 0 2rem;
  }
  .sidebar.open { display: block; }
  .content { padding: 2rem 0 4rem; }
  .header-search { max-width: none; }
  .pager-nav { grid-template-columns: 1fr; }
  .pager.next { text-align: left; }
}

@media print {
  .site-header, .sidebar, .toc, .pager-nav, .skip-link { display: none !important; }
  .layout { display: block; }
  .content { max-width: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
}
