/* ==========================================================================
   Site stylesheet — marketing pages, docs and /legal/ pages.
   No build step. Light + dark via prefers-color-scheme.
   Aesthetic: technical drawing. Hairlines, title blocks, monospace numerals.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --paper: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #ebeef2;
  --ink: #17202b;
  --ink-2: #44505e;
  --line: #c9cfd8;
  --line-strong: #17202b;
  --accent: #1b55b5;
  --accent-hover: #123f8a;
  --accent-ink: #ffffff;
  --grid: rgba(27, 85, 181, 0.075);
  --grid-major: rgba(27, 85, 181, 0.13);
  --code-bg: #eef1f5;
  --ok: #17663a;
  --err: #a8231c;
  --err-bg: #fdecea;
  --warn-bg: #fff3cf;
  --warn-ink: #513c00;
  --warn-line: #d9b441;
  --render-bg: #f4f5f7; /* the renderer's default bg, kept light in both themes */
  --checker-a: #ffffff;
  --checker-b: #dfe3e9;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 2px;
  --step: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1319;
    --surface: #151c24;
    --surface-2: #1b242e;
    --ink: #e6ebf1;
    --ink-2: #a6b1be;
    --line: #2d3945;
    --line-strong: #8f9cab;
    --accent: #82b2ff;
    --accent-hover: #a9caff;
    --accent-ink: #0b1118;
    --grid: rgba(130, 178, 255, 0.06);
    --grid-major: rgba(130, 178, 255, 0.11);
    --code-bg: #121920;
    --ok: #7fd6a0;
    --err: #ff9a91;
    --err-bg: #3a1a18;
    --warn-bg: #352b0c;
    --warn-ink: #ffe08a;
    --warn-line: #8a6d1a;
    --checker-a: #2a3440;
    --checker-b: #1d252e;
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

body > main { flex: 1 0 auto; }

img, svg { max-width: 100%; height: auto; }
img { display: block; }
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-weight: 650;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2rem); }
h3 { font-size: 1.125rem; letter-spacing: -0.005em; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin-bottom: 0.3em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

small, .small { font-size: 0.875rem; }
.muted { color: var(--ink-2); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 8px 12px;
}
.skip-link:focus { top: 8px; color: var(--paper); }

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

/* ---------- Code ---------- */

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.05em 0.35em;
  white-space: break-spaces;
}
pre {
  position: relative;
  margin: 0 0 1.25em;
  padding: 16px 18px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.84rem;
  tab-size: 2;
}
pre code { font-size: inherit; background: none; border: 0; padding: 0; }
pre .c { color: var(--ink-2); }           /* comment */
pre .k { color: var(--accent); }          /* keyword-ish highlight */

.code-block { position: relative; margin: 0 0 1.25em; }
.code-block > pre { margin: 0; }
.code-label {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--line); border-bottom: 0;
  padding: 6px 10px 6px 18px; background: var(--surface);
}
.copy-btn {
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 2px 8px; cursor: pointer;
}
.copy-btn:hover { color: var(--ink); border-color: var(--line-strong); }
pre > .copy-btn {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--surface);
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-narrow { max-width: calc(820px + 2 * var(--gutter)); }

.section { padding-block: clamp(48px, 7vw, 88px); border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; }
.section-tight { padding-block: clamp(32px, 5vw, 56px); }

.section-head { max-width: 46rem; margin-bottom: clamp(24px, 4vw, 40px); }
.section-head p { color: var(--ink-2); font-size: 1.0625rem; margin-bottom: 0; }

/* drafting-style label: "01 / CONVERTER" */
.label {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 14px;
}
.label::before {
  content: ""; flex: 0 0 28px; height: 1px; background: var(--line-strong);
}
.label b { color: var(--accent); font-weight: 600; }

.grid-2 { display: grid; gap: clamp(24px, 4vw, 48px); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid-3 { display: grid; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Header ---------- */

#site-header:empty { min-height: 61px; } /* filled by chrome.js */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
  z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-mono); font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em;
  padding: 6px 0;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand .tag {
  font-size: 0.625rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--ink-2); padding: 1px 5px; border-radius: var(--radius);
}

.nav-toggle {
  display: none;
  font: 500 0.8125rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: transparent;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 12px; cursor: pointer;
}

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a, .nav-dd > summary {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); text-decoration: none;
  font-size: 0.9375rem; font-weight: 500;
  padding: 8px 12px; border-radius: var(--radius);
  cursor: pointer;
}
.site-nav a:hover, .nav-dd > summary:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav .nav-cta {
  border: 1px solid var(--line-strong); margin-left: 8px;
}
.site-nav .nav-cta:hover { background: var(--ink); color: var(--paper); }

.nav-dd { position: relative; }
.nav-dd > summary { list-style: none; user-select: none; }
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd > summary::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav-dd[open] > summary { background: var(--surface-2); }
.nav-dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 6px; margin: 0; list-style: none;
  box-shadow: 4px 4px 0 var(--line);
}
.nav-dd-menu li { margin: 0; }
.nav-dd-menu a { display: flex; justify-content: space-between; gap: 16px; width: 100%; }
.nav-dd-menu a span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-2); letter-spacing: 0.04em; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .site-header .wrap { flex-wrap: wrap; }
  .site-nav {
    display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0;
    padding: 4px 0 14px; border-top: 1px solid var(--line);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a, .nav-dd > summary { padding: 11px 4px; }
  .site-nav .nav-cta { margin: 8px 0 0; justify-content: center; }
  .nav-dd-menu { position: static; box-shadow: none; border: 0; border-left: 1px solid var(--line); margin-left: 6px; padding: 0 0 0 10px; min-width: 0; background: transparent; }
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-strong);
  background: var(--paper);
  margin-top: clamp(32px, 6vw, 72px);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 0;
}
.footer-grid > div {
  padding: 28px 24px 28px 0;
}
.footer-grid > div + div { border-left: 1px solid var(--line); padding-left: 24px; }
.footer-grid h2 {
  font: 600 0.72rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 12px;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 0 0 6px; }
.footer-grid a { color: var(--ink); text-decoration: none; }
.footer-grid a:hover { text-decoration: underline; color: var(--accent); }
.footer-grid p { color: var(--ink-2); margin: 10px 0 0; max-width: 34ch; }
.footer-bar {
  border-top: 1px solid var(--line);
  padding-block: 14px 22px;
  display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2);
}
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div { padding: 22px 16px 22px 0; }
  .footer-grid > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .footer-grid > div + div { padding-left: 0; border-left: 0; }
  .footer-grid > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 0.9375rem/1.2 var(--font-sans);
  padding: 12px 18px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
  text-decoration: none; cursor: pointer;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-small { padding: 8px 12px; font-size: 0.875rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn .arrow { font-family: var(--font-mono); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  border-bottom: 1px solid var(--line-strong);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 64px); align-items: center;
  padding-block: clamp(40px, 7vw, 88px);
}
.hero-copy .lede { font-size: clamp(1.05rem, 0.98rem + 0.5vw, 1.25rem); color: var(--ink-2); max-width: 36em; }
.hero-copy h1 { margin-bottom: 0.45em; }
.hero-copy h1 em { font-style: normal; color: var(--accent); }
.hero-facts {
  display: flex; flex-wrap: wrap; gap: 0; margin: 28px 0 0; padding: 0; list-style: none;
  border: 1px solid var(--line-strong); background: var(--surface); width: fit-content; max-width: 100%;
}
.hero-facts li {
  margin: 0; padding: 10px 16px; font-size: 0.8125rem; color: var(--ink-2);
  border-right: 1px solid var(--line); flex: 1 1 auto;
}
.hero-facts li:last-child { border-right: 0; }
.hero-facts b { display: block; font: 600 1.125rem var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 440px; }
}
@media (max-width: 480px) {
  .hero-facts { width: 100%; }
  .hero-facts li { flex-basis: 50%; border-bottom: 1px solid var(--line); }
  .hero-facts li:nth-child(2n) { border-right: 0; }
  .hero-facts li:nth-last-child(-n+2) { border-bottom: 0; }
}

/* Page hero for inner pages */
.page-hero {
  border-bottom: 1px solid var(--line-strong);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  padding-block: clamp(36px, 6vw, 64px);
}
.page-hero h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); max-width: 20em; }
.page-hero .lede { font-size: 1.125rem; color: var(--ink-2); max-width: 44em; margin-bottom: 0; }
.page-hero .btn-row { margin-top: 24px; }

/* ---------- Drawing sheet (figure with title block) ---------- */

.sheet {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  position: relative;
}
.sheet::before, .sheet::after {
  /* registration ticks */
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none;
  border: 0 solid var(--line-strong);
}
.sheet::before { top: -5px; left: -5px; border-top-width: 1px; border-left-width: 1px; }
.sheet::after { bottom: -5px; right: -5px; border-bottom-width: 1px; border-right-width: 1px; }
.sheet > img, .sheet > .sheet-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: contain;
  background: var(--render-bg);
}
.sheet > img.is-transparent, .checker {
  background-color: var(--checker-a);
  background-image:
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%),
    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.sheet figcaption, .title-block {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  border-top: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.35;
  color: var(--ink);
}
.title-block > span, .sheet figcaption > span {
  padding: 7px 10px; border-right: 1px solid var(--line); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.title-block > span:last-child, .sheet figcaption > span:last-child { border-right: 0; }
.title-block i, .sheet figcaption i {
  display: block; font-style: normal; font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}

.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.gallery .sheet-wide { grid-column: span 2; grid-row: span 2; }
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .gallery { gap: 14px; } .gallery .sheet figcaption { grid-template-columns: 1fr; } .gallery .sheet figcaption > span + span { display: none; } }

/* ---------- Feature grid ---------- */

.features { border: 1px solid var(--line-strong); background: var(--surface); }
.feature {
  padding: 22px 22px 18px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-right: -1px; margin-bottom: -1px;
}
.feature h3 { margin-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
.feature h3 .idx { font: 500 0.72rem var(--font-mono); color: var(--accent); letter-spacing: 0.06em; }
.feature p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; }
.features { overflow: hidden; }

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  margin: 0 0 1.25em;
}
.table-scroll > table { margin: 0; border: 0; }
.table-scroll:focus-visible { outline-offset: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 0 0 1.25em;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
caption {
  caption-side: bottom; text-align: left; padding: 10px 12px;
  font-size: 0.8125rem; color: var(--ink-2); border-top: 1px solid var(--line);
}
th, td {
  padding: 10px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
tr:last-child > td, tr:last-child > th { border-bottom: 0; }
thead th {
  font: 600 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
tbody th { font-weight: 600; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td code, th code { white-space: nowrap; }
td .wrap-code code { white-space: break-spaces; }
tr.is-highlight > * { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
tr.is-highlight > th { box-shadow: inset 3px 0 0 var(--accent); }

.bench td.num { font-size: 1.0625rem; font-weight: 600; }
.bar { display: block; height: 6px; background: var(--ink); margin-top: 8px; min-width: 2px; }
.bar.is-accent { background: var(--accent); }

/* ---------- Notes / banners ---------- */

.note, .draft-banner {
  border: 1px solid var(--warn-line);
  border-left-width: 4px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  padding: 12px 16px;
  margin: 0 0 1.5em;
  font-size: 0.9375rem;
  border-radius: var(--radius);
}
.note a, .draft-banner a { color: inherit; }
.draft-banner { font-family: var(--font-mono); font-size: 0.8125rem; }
.note-info {
  border-color: var(--line-strong); background: var(--surface); color: var(--ink);
}
.note > :last-child { margin-bottom: 0; }
.note strong:first-child, .draft-banner strong:first-child { letter-spacing: 0.01em; }

.privacy-line {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.9375rem; font-weight: 600; color: var(--ink);
  margin: 0;
}
.privacy-line::before {
  content: ""; flex: none; width: 10px; height: 10px; margin-top: 0.45em;
  background: var(--ok); border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

/* ---------- FAQ (details) ---------- */

.faq { border-top: 1px solid var(--line-strong); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom-color: var(--line-strong); }
.faq summary {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 16px 4px; cursor: pointer; font-weight: 600; font-size: 1.0313rem;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; font: 500 1.125rem/1 var(--font-mono); color: var(--accent);
}
.faq details[open] > summary::after { content: "\2212"; }
.faq summary:hover { color: var(--accent); }
.faq .answer { padding: 0 4px 18px; color: var(--ink-2); max-width: 46rem; }
.faq .answer > :last-child { margin-bottom: 0; }

/* ---------- Steps (numbered how-to) ---------- */

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 0; border: 1px solid var(--line-strong); background: var(--surface); }
.steps > li {
  counter-increment: step; margin: 0; padding: 16px 18px 16px 64px; position: relative;
  border-bottom: 1px solid var(--line);
}
.steps > li:last-child { border-bottom: 0; }
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 18px; top: 16px;
  font: 600 0.875rem/1.6 var(--font-mono); color: var(--accent);
  border-right: 1px solid var(--line); padding-right: 12px; width: 34px;
}
.steps strong { display: block; }
.steps span { color: var(--ink-2); font-size: 0.9375rem; }

/* ---------- CTA band ---------- */

.cta {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: clamp(24px, 4vw, 40px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  position: relative;
}
.cta h2 { margin-bottom: 8px; }
.cta p { margin: 0; color: var(--ink-2); max-width: 44em; }
@media (max-width: 720px) { .cta { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Converter widget (WASM) and STEP demo ---------- */

.converter, .step-demo {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  position: relative;
}
/* Reserve the height the scripts will fill, so mounting them moves nothing (CLS). */
.converter:empty { min-height: 656px; }
.step-demo:empty { min-height: 756px; }
@media (max-width: 800px) {
  .converter:empty { min-height: 1144px; }
  .step-demo:empty { min-height: 1280px; }
}
.cv-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line-strong); background: var(--surface-2);
}
.cv-bar .cv-kind { font: 500 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.cv-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cv-left { padding: 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cv-right { padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 800px) {
  .cv-body { grid-template-columns: minmax(0, 1fr); }
  .cv-left { border-right: 0; border-bottom: 1px solid var(--line); }
}

.cv-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center;
  min-height: 150px; padding: 20px 14px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.cv-drop:hover, .cv-drop.is-over { border-color: var(--accent); background-color: color-mix(in srgb, var(--accent) 8%, transparent); }
.cv-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.cv-drop strong { font-size: 1rem; }
.cv-drop span { font-size: 0.8438rem; color: var(--ink-2); }
.cv-drop .cv-file { font-family: var(--font-mono); color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.cv-drop { position: relative; }

.cv-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.cv-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.cv-opts legend {
  font: 600 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  padding: 0; margin-bottom: 10px;
}
.cv-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8125rem; color: var(--ink-2); min-width: 0; }
.cv-field select, .cv-field input[type="color"] {
  font: 500 0.875rem var(--font-mono); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  height: 36px; padding: 0 8px; width: 100%; min-width: 0;
}
.cv-field input[type="color"] { padding: 3px; cursor: pointer; }
.cv-checks { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.cv-check { display: flex; align-items: center; gap: 8px; font-size: 0.9063rem; color: var(--ink); cursor: pointer; }
.cv-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.cv-check small { color: var(--ink-2); }
@media (max-width: 420px) {
  .cv-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv-checks { grid-template-columns: minmax(0, 1fr); }
}

.cv-stage {
  position: relative;
  aspect-ratio: 1 / 1; width: 100%;
  border: 1px solid var(--line);
  background: var(--render-bg);
  display: grid; place-items: center;
  overflow: hidden;
}
.cv-stage img { width: 100%; height: 100%; object-fit: contain; }
.cv-stage .cv-empty {
  font: 500 0.75rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: #5b6672; text-align: center; padding: 16px;
}
.cv-stage.is-busy::after {
  content: "rendering\2026"; position: absolute; left: 8px; bottom: 8px;
  font: 500 0.72rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  background: #17202b; color: #fff; padding: 3px 8px;
}
.cv-stats { margin: 0; }
.cv-stats.title-block { border: 1px solid var(--line); }
.cv-msg { margin: 0; font-size: 0.9063rem; min-height: 1.5em; color: var(--ink-2); }
.cv-msg.is-error {
  color: var(--err); background: var(--err-bg); border: 1px solid currentColor; border-left-width: 4px;
  padding: 10px 12px; border-radius: var(--radius);
}
.cv-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; align-items: center;
}
.cv-foot .small { color: var(--ink-2); margin: 0; }

/* ---------- Plans ---------- */

.plans td.price, .plans th.price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plans tbody th { white-space: nowrap; }
.plans .plan-note { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--ink-2); white-space: normal; }

.units { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-strong); background: var(--surface); }
.units > div { padding: 18px; border-right: 1px solid var(--line); }
.units > div:last-child { border-right: 0; }
.units b { display: block; font: 600 1.75rem/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.units span { font-size: 0.875rem; color: var(--ink-2); }
@media (max-width: 700px) {
  .units { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .units > div:nth-child(2n) { border-right: 0; }
  .units > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

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

.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding-block: clamp(28px, 5vw, 56px); align-items: start; }
.docs-toc {
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
  font-size: 0.9063rem; border: 1px solid var(--line-strong); background: var(--surface);
}
.docs-toc h2 { font: 600 0.72rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.docs-toc ol { list-style: none; margin: 0; padding: 6px; counter-reset: toc; }
.docs-toc li { margin: 0; counter-increment: toc; }
.docs-toc a { display: flex; gap: 10px; padding: 6px 8px; color: var(--ink); text-decoration: none; border-radius: var(--radius); }
.docs-toc a::before { content: counter(toc, decimal-leading-zero); font: 500 0.72rem/1.9 var(--font-mono); color: var(--ink-2); }
.docs-toc a:hover { background: var(--surface-2); color: var(--accent); }
.docs-body { min-width: 0; }
.docs-body > section { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.docs-body > section:last-child { border-bottom: 0; margin-bottom: 0; }
.docs-body h2 { margin-top: 0; }
.docs-body h3 { margin-top: 1.75em; }
.docs-body p, .docs-body li { max-width: 46rem; }
@media (max-width: 860px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: static; max-height: none; }
  .docs-toc ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) { .docs-toc ol { grid-template-columns: minmax(0, 1fr); } }

.endpoint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 0.9375rem;
  border: 1px solid var(--line-strong); background: var(--surface); padding: 10px 12px; margin: 0 0 1em;
  overflow-wrap: anywhere;
}
.method {
  font: 700 0.72rem var(--font-mono); letter-spacing: 0.08em;
  padding: 3px 8px; background: var(--ink); color: var(--paper); border-radius: var(--radius);
}
.method.get { background: var(--accent); color: var(--accent-ink); }

/* ---------- Contact form (mailto builder) ---------- */

.form { display: grid; gap: 14px; border: 1px solid var(--line-strong); background: var(--surface); padding: clamp(16px, 3vw, 28px); }
.form label { display: grid; gap: 5px; font-size: 0.875rem; font-weight: 600; }
.form input, .form select, .form textarea {
  font: 400 1rem var(--font-sans); color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 10px 12px; width: 100%; min-width: 0;
}
.form textarea { min-height: 120px; resize: vertical; }
.form .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .form .form-row { grid-template-columns: minmax(0, 1fr); } }
.form .small { color: var(--ink-2); margin: 0; font-weight: 400; }

/* ---------- Spec list ---------- */

.spec { display: grid; grid-template-columns: max-content minmax(0, 1fr); border: 1px solid var(--line-strong); background: var(--surface); margin: 0 0 1.25em; }
.spec dt, .spec dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.spec dt { font: 600 0.75rem/1.9 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); border-right: 1px solid var(--line); }
.spec dt:last-of-type, .spec dd:last-of-type { border-bottom: 0; }
@media (max-width: 520px) {
  .spec { grid-template-columns: minmax(0, 1fr); }
  .spec dt { border-right: 0; border-bottom: 0; padding-bottom: 0; }
  .spec dt:last-of-type { border-bottom: 0; }
}

/* ---------- Prose (legal pages, long-form) ---------- */

main.prose, .prose {
  width: 100%;
  max-width: calc(760px + 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(32px, 6vw, 64px) var(--gutter);
}
.prose .prose { padding: 0; }
.prose h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.6rem); margin-bottom: 0.6em; }
.prose h2 { font-size: 1.4rem; margin-top: 2.2em; padding-top: 1.1em; border-top: 1px solid var(--line); }
.prose h3 { margin-top: 1.8em; }
.prose h1 + h2 { margin-top: 1.2em; }
.prose li { margin-bottom: 0.45em; }
.prose table { display: block; width: 100%; overflow-x: auto; border: 0; background: transparent; }
.prose table > * { background: var(--surface); }
.prose th, .prose td { border: 1px solid var(--line); }
.prose thead th { white-space: normal; }
.prose td code, .prose th code { white-space: break-spaces; }
.prose address { font-style: normal; margin-bottom: 1em; }
.prose blockquote { margin: 0 0 1em; padding: 4px 0 4px 16px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.product-name { font-weight: inherit; }

/* ---------- 404 ---------- */

.notfound { text-align: left; padding-block: clamp(56px, 10vw, 120px); }
.notfound .code { font: 600 clamp(4rem, 2rem + 12vw, 9rem)/0.9 var(--font-mono); letter-spacing: -0.05em; color: transparent; -webkit-text-stroke: 1.5px var(--line-strong); margin: 0 0 16px; }
.notfound ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* ---------- Motion / print ---------- */

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

@media print {
  .site-header, .site-footer, .nav-toggle, .copy-btn, .converter, .step-demo { display: none !important; }
  body { background: #fff; color: #000; }
  .hero, .page-hero { background: none; }
}

/* ---------- 3D viewer (/viewer/) ---------- */
.viewer { border: 1px solid var(--line-strong); background: var(--surface); }
.viewer:empty { min-height: 640px; }
.vw-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.vw-main { padding: 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vw-side { padding: 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.vw-stage { position: relative; aspect-ratio: 4 / 3; background: var(--render-bg); border: 1px dashed var(--line); }
.vw-stage.is-over { border-color: var(--accent); }
.vw-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.vw-canvas:active { cursor: grabbing; }
.vw-canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vw-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; }
.viewer.is-loaded .vw-empty { display: none; }
.vw-hint { margin: 0; color: #44505e; }
.vw-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.vw-controls { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.vw-controls select, .vw-downloads select { font: inherit; font-size: 0.875rem; padding: 6px 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); }
.vw-status { margin: 0; min-height: 1.4em; font-size: 0.875rem; color: var(--err); }
.vw-h { margin: 0; font: 500 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.vw-info { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; font-size: 0.875rem; }
.vw-info dt { color: var(--ink-2); }
.vw-info dd { margin: 0; font-family: var(--font-mono); overflow-wrap: anywhere; }
.vw-downloads { display: flex; flex-direction: column; gap: 10px; }
.vw-code { width: 100%; font: 0.75rem var(--font-mono); padding: 8px; border: 1px solid var(--line); background: var(--code-bg); color: var(--ink); resize: vertical; }
@media (max-width: 800px) {
  .viewer:empty { min-height: 900px; }
  .vw-body { grid-template-columns: minmax(0, 1fr); }
  .vw-main { border-right: 0; border-bottom: 1px solid var(--line); }
}
/* ?embed=1: only the viewer */
html[data-embed="1"] #site-header, html[data-embed="1"] #site-footer, html[data-embed="1"] .vw-hide-embed { display: none; }
html[data-embed="1"] .section { padding: 0; }
html[data-embed="1"] .wrap { max-width: none; padding: 0; }
html[data-embed="1"] .vw-side { display: none; }
html[data-embed="1"] .vw-body { grid-template-columns: minmax(0, 1fr); }
html[data-embed="1"] .vw-main { border-right: 0; }

/* ---------- Quoting calculators (quote-tools.js) ---------- */

/* Reserved for the widget before it mounts (CLS); heights measured in a browser at 1024 and 375-412 px. */
.quote-tool[data-tool="print"]:empty { min-height: 742px; }
.quote-tool[data-tool="cut"]:empty { min-height: 645px; }
.quote-tool[data-tool="volume"]:empty { min-height: 607px; }
@media (max-width: 800px) {
  .quote-tool[data-tool="print"]:empty { min-height: 1545px; }
  .quote-tool[data-tool="cut"]:empty { min-height: 1455px; }
  .quote-tool[data-tool="volume"]:empty { min-height: 1100px; }
}
.qt-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qt-sub {
  grid-column: 1 / -1; margin: 6px 0 -4px; padding-top: 8px; border-top: 1px solid var(--line);
  font: 600 0.72rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.qt-sub:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.qt-wide { grid-column: 1 / -1; }
.cv-field input[type="number"] {
  font: 500 0.875rem var(--font-mono); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  height: 36px; padding: 0 8px; width: 100%; min-width: 0;
}
.cv-field select:disabled { opacity: 0.6; }
.qt-stage { aspect-ratio: 4 / 3; }
.qt-results {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); margin: 0;
  border: 1px solid var(--line); font-size: 0.9063rem;
}
.qt-results dt, .qt-results dd { margin: 0; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.qt-results dt { color: var(--ink-2); }
.qt-results dd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.qt-results dt:nth-last-child(2), .qt-results dd:last-child { border-bottom: 0; }
.qt-results .qt-strong { font-weight: 700; color: var(--ink); }
@media (max-width: 420px) { .qt-opts { grid-template-columns: minmax(0, 1fr); } }

/* Accuracy table on the print estimator page */
.num-table td, .num-table th { font-variant-numeric: tabular-nums; }
.num-table td.n { font-family: var(--font-mono); text-align: right; white-space: nowrap; }

/* ---------- Ad slots (off unless config.js sets `ads`) ---------- */

.ad-slot { display: none; }
.ads-on .ad-slot {
  display: block; margin-inline: auto; max-width: var(--wrap); padding-inline: var(--gutter);
  min-height: 130px; /* reserved, so a filled slot moves nothing (CLS) */
}
.ads-on .ad-slot::before {
  content: "Advertisement"; display: block; margin-bottom: 4px;
  font: 500 0.66rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.ads-on .ad-slot > * { min-height: 100px; }
.link-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--accent); }

/* Static mode (no API yet): config.js adds html.api-live when an API base is set. */
.api-note {
  margin-top: 16px; padding: 10px 14px; border-left: 3px solid var(--accent);
  background: var(--surface-2); font-size: .95rem;
}
.api-live .api-note { display: none; }
.step-demo.is-static { min-height: 756px; }
.step-demo.is-static .cv-left > p { margin: 0 0 12px; }
.step-demo.is-static .cv-stage img { width: 100%; height: auto; max-width: 512px; }
@media (max-width: 800px) { .step-demo.is-static { min-height: 1280px; } }
