/* ---------------------------------------------------------------
   Craft floor.

   Everything below is byte-identical in every page that gets it
   right, so it ships here rather than being re-typed from the
   rules each time. Replace the :root values with the page's own
   palette; do not delete the rules that consume them.
   --------------------------------------------------------------- */

:root {
  /* Technical specification palette */
  --ink: #0A0A0A;
  --ink-muted: #505050;
  --bg: #FFFFFF;
  --surface: #F8F8F8;
  --rule: #D0D0D0;
  --accent: #2F5C2E;
  --accent-ink: #FFFFFF;
  --code-bg: #1A1A1A;
  --code-ink: #E8E8E8;

  --measure: 70ch;

  scrollbar-color: var(--rule) transparent;
  caret-color: var(--accent);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8E8E8;
    --ink-muted: #909090;
    --bg: #0D0D0D;
    --surface: #1A1A1A;
    --rule: #2A2A2A;
    --accent: #4A8447;
    --accent-ink: #E8E8E8;
    --code-bg: #000000;
    --code-ink: #E8E8E8;
  }
}

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

html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}

p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  text-wrap: balance;
  font-weight: 500;
}

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

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

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

.num {
  font-variant-numeric: tabular-nums;
}

button,
[role="button"],
summary,
input[type="checkbox"],
input[type="radio"] {
  min-height: 44px;
}

button {
  min-width: 44px;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

pre {
  overflow-x: auto;
}

table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

@media (max-width: 480px) {
  body {
    padding-inline: 1rem;
  }
}

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

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .section-marker {
    position: static !important;
    display: inline-block;
    margin-right: 1rem;
  }

  .code-block {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ccc;
  }

  .spec-toc {
    page-break-after: always;
  }
}

/* ---------------------------------------------------------------
   Technical specification structure
   --------------------------------------------------------------- */

.spec-document {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.spec-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--rule);
}

.spec-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem 0;
}

.spec-meta {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin: 0;
}

/* Table of contents */
.spec-toc {
  margin-bottom: 3rem;
  padding: 1.5rem;
  background: var(--surface);
  border-left: 1px solid var(--accent);
}

.toc-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.toc-list li {
  margin-bottom: 0.5rem;
}

.toc-list li::before {
  content: counter(section, decimal) ".0";
  counter-increment: section;
  display: inline-block;
  width: 3rem;
  color: var(--ink-muted);
}

.toc-list a {
  text-decoration: none;
  color: var(--ink);
  transition: color 0.2s;
}

.toc-list a:hover {
  color: var(--accent);
}

/* Sections */
.spec-section {
  position: relative;
  margin-bottom: 4rem;
  padding-left: 4rem;
}

.section-marker {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-muted);
  width: 3rem;
  text-align: right;
}

.section-content {
  max-width: var(--measure);
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  letter-spacing: -0.01em;
}

.section-intro {
  margin: 0 0 2rem 0;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
}

/* Steps */
.step-block {
  margin-bottom: 2.5rem;
}

.step-block.verify {
  border-left: 1px solid var(--accent);
  padding-left: 1rem;
  margin-left: -1rem;
}

.step-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.step-desc {
  margin: 0 0 0.75rem 0;
  font-size: 0.9375rem;
}

.step-note {
  margin: 0.75rem 0 0 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
  font-style: italic;
}

/* Code blocks */
.code-block {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 2px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}

.code-block code {
  font-family: inherit;
  background: none;
  padding: 0;
}

.inline-code {
  font-family: inherit;
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 2px;
  font-size: 0.9em;
}

.verify-expected {
  margin: 0.75rem 0 0 0;
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
}

/* Footer */
.spec-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px solid var(--rule);
}

.footer-text {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-size: 0.9375rem;
}

.footer-meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .spec-document {
    padding: 2rem 1rem;
  }

  .spec-section {
    padding-left: 0;
  }

  .section-marker {
    position: static;
    display: block;
    width: auto;
    text-align: left;
    margin-bottom: 0.5rem;
  }

  .spec-title {
    font-size: 1.25rem;
  }

  body {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .spec-header {
    margin-bottom: 2rem;
  }

  .spec-toc {
    padding: 1rem;
  }

  .toc-list li::before {
    width: 2.5rem;
  }

  .code-block {
    padding: 0.75rem;
    font-size: 0.8125rem;
  }
}
@media (max-width: 480px) {
  /* --impeccable-mobile-pad */
  body { padding-inline: max(1rem, 16px); }
  .container, [class*="container"], section, header, footer, nav, main, article {
    padding-inline: max(1rem, 16px);
  }
}
/* --impeccable-measure */
p, li, dt, dd, blockquote, figcaption, td, th { max-width: min(75ch, 100%); }
