/* ---------------------------------------------------------------
   Craft floor - byte-identical foundation
   --------------------------------------------------------------- */

:root {
  /* Signal palette: charcoal + safety orange (like network status LEDs) */
  --ink: #1a1a1a;
  --ink-muted: #525252;
  --ink-light: #737373;
  --bg: #ffffff;
  --surface: #f5f5f5;
  --surface-hover: #ebebeb;
  --rule: #e5e5e5;
  --rule-strong: #d4d4d4;
  --accent: #ff6b35;
  --accent-hover: #e55a28;
  --accent-ink: #ffffff;
  --accent-light: #fff3ef;
  --success: #0f8640;
  --warning: #f59e0b;
  --error: #dc2626;

  /* Technical palette for status indicators */
  --status-good: #0f8640;
  --status-avoid: #dc2626;

  --measure: 65ch;

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

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f5;
    --ink-muted: #a3a3a3;
    --ink-light: #737373;
    --bg: #0a0a0a;
    --surface: #1a1a1a;
    --surface-hover: #262626;
    --rule: #262626;
    --rule-strong: #404040;
    --accent: #ff8c61;
    --accent-hover: #ffa782;
    --accent-ink: #0a0a0a;
    --accent-light: #2d1410;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --status-good: #34d399;
    --status-avoid: #f87171;
  }
}

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

html {
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
}

p {
  text-wrap: pretty;
  max-width: var(--measure);
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  margin-top: 0;
  max-width: var(--measure);
}

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

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  border-bottom: 1px solid transparent;
  transition: border-color 150ms ease;
}

a:hover {
  border-bottom-color: currentColor;
}

.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,
code {
  overflow-x: auto;
}

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

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

.container {
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 640px) {
  .container {
    padding-inline: 2rem;
  }
}

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

.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding-block: 2rem;
  margin-bottom: 2.5rem;
}

.site-header .container {
  max-width: var(--measure);
}

.site-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--measure);
}

.site-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--accent);
  flex-shrink: 0;
}

.site-tagline {
  font-size: 1rem;
  color: var(--ink-muted);
  margin: 0;
  max-width: var(--measure);
}

/* ---------------------------------------------------------------
   Table of Contents
   --------------------------------------------------------------- */

.table-of-contents {
  background: var(--accent-light);
  border-left: 1px solid var(--accent);
  padding-block: 1.5rem;
  margin-bottom: 3rem;
}

.table-of-contents .container {
  max-width: var(--measure);
}

.toc-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 1rem;
}

.toc-list {
  margin: 0;
  padding-left: 1.5rem;
  display: grid;
  gap: 0.5rem;
  max-width: var(--measure);
}

.toc-list li {
  font-weight: 500;
}

.toc-list a {
  color: var(--ink);
  border-bottom-color: var(--rule);
}

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

/* ---------------------------------------------------------------
   Main content
   --------------------------------------------------------------- */

.main-content {
  padding-bottom: 4rem;
}

.guide-section {
  margin-bottom: 4rem;
  scroll-margin-top: 1rem;
  position: relative;
  max-width: var(--measure);
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--ink);
  max-width: var(--measure);
}

.section-intro {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ink-muted);
  margin-bottom: 2rem;
  max-width: var(--measure);
}

.guide-section h3 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  max-width: var(--measure);
}

.guide-section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  max-width: var(--measure);
}

/* ---------------------------------------------------------------
   Lists
   --------------------------------------------------------------- */

li {
  max-width: var(--measure);
}

ul,
ol {
  max-width: var(--measure);
}

.feature-list,
.checklist {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  display: grid;
  gap: 0.75rem;
  max-width: var(--measure);
}

.feature-list li,
.checklist li {
  padding-left: 0.5rem;
}

.checklist {
  list-style: none;
  padding-left: 0;
}

.checklist li::before {
  content: "□";
  color: var(--accent);
  font-weight: 700;
  display: inline-block;
  width: 1.5rem;
  margin-left: -1.5rem;
}

.step-list {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  display: grid;
  gap: 1.5rem;
  max-width: var(--measure);
}

.step-list > li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3rem;
}

.step-list > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.step-list > li > strong {
  display: block;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  max-width: var(--measure);
}

.step-list > li > p {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--ink-muted);
  max-width: var(--measure);
}

.step-list > li > ol {
  margin-top: 0.75rem;
  padding-left: 1.5rem;
  max-width: var(--measure);
}

.step-list > li > ol > li {
  margin-bottom: 0.5rem;
  max-width: var(--measure);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  background: var(--bg);
}

.data-table thead {
  background: var(--surface);
  border-bottom: 2px solid var(--rule-strong);
}

.data-table th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.data-table code {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------
   Inline code
   --------------------------------------------------------------- */

:not(pre) > code {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Status badges
   --------------------------------------------------------------- */

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.status-good {
  background: var(--status-good);
  color: #ffffff;
}

.status-badge.status-avoid {
  background: var(--status-avoid);
  color: #ffffff;
}

/* ---------------------------------------------------------------
   Callouts
   --------------------------------------------------------------- */

.callout {
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 1px solid;
  max-width: var(--measure);
}

.callout strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  max-width: var(--measure);
}

.callout p {
  max-width: var(--measure);
}

.callout-tip {
  background: var(--accent-light);
  border-color: var(--accent);
}

.callout-warning {
  background: #fef3c7;
  border-color: var(--warning);
  color: #78350f;
}

@media (prefers-color-scheme: dark) {
  .callout-warning {
    background: #451a03;
    color: #fef3c7;
  }
}

/* ---------------------------------------------------------------
   Control methods & security practices
   --------------------------------------------------------------- */

.control-method,
.security-practice {
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--rule);
  max-width: var(--measure);
}

.control-method h4,
.security-practice h4 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.control-method p,
.security-practice p {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  max-width: var(--measure);
}

.control-method ol,
.security-practice ol {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  max-width: var(--measure);
}

.control-method ol li,
.security-practice ol li {
  margin-bottom: 0.5rem;
  max-width: var(--measure);
}

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

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--rule);
  padding-block: 2rem;
  margin-top: 4rem;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.site-footer .container {
  max-width: var(--measure);
}

.site-footer p {
  margin: 0.5rem 0;
  max-width: var(--measure);
}

.footer-meta {
  font-size: 0.875rem;
  color: var(--ink-light);
  max-width: var(--measure);
}

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

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

  a,
  .data-table tbody tr {
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  }
}

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

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-header {
    background: #fff;
    border-bottom: 2px solid #000;
    padding-block: 1rem;
  }

  .site-icon {
    display: none;
  }

  .table-of-contents {
    background: #fff;
    border-left: 1px solid #000;
    page-break-after: always;
  }

  .guide-section {
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }

  .section-marker {
    color: #999;
  }

  .data-table {
    font-size: 9pt;
  }

  .data-table thead {
    background: #f5f5f5;
  }

  .callout {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  .callout-tip {
    background: #f9f9f9;
  }

  .callout-warning {
    background: #fffbeb;
  }

  .site-footer {
    background: #fff;
    border-top: 1px solid #999;
    font-size: 9pt;
    page-break-before: always;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #666;
  }
}
@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);
  }
}
