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

:root {
  --ink: #1f2937;
  --ink-muted: #94a3b8;
  --bg: #1a2332;
  --surface: #fafaf9;
  --rule: #e5e7eb;
  --accent: #d97706;
  --accent-ink: #1a2332;
  --measure: 60ch;

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

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f9fafb;
    --ink-muted: #9ca3af;
    --bg: #0f172a;
    --surface: #1e293b;
    --rule: #334155;
    --accent: #fbbf24;
    --accent-ink: #0f172a;
  }
}

*,
*::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;
}

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

::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;
  }

  .copy-btn,
  .toc {
    display: none;
  }

  .code-block {
    border: 1px solid #000;
  }
}

/* ---------------------------------------------------------------
   Page structure
   --------------------------------------------------------------- */

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-header {
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5rem 0;
  color: #f9fafb;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--ink-muted);
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .subtitle {
    color: #94a3b8;
  }
}

/* ---------------------------------------------------------------
   Table of contents
   --------------------------------------------------------------- */

.toc {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 3rem;
  position: sticky;
  top: 1rem;
  z-index: 10;
}

.toc h2 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

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

.toc li:last-child {
  margin-bottom: 0;
}

.toc a {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}

.toc a::before {
  content: counter(toc-counter) ".";
  display: inline-block;
  min-width: 1.5rem;
  color: var(--ink-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.toc a:hover {
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent);
}

.toc a.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.toc a.active::before {
  color: var(--accent-ink);
}

@media (max-width: 768px) {
  .toc {
    position: static;
  }
}

/* ---------------------------------------------------------------
   Guide content
   --------------------------------------------------------------- */

.guide-content {
  background: var(--surface);
  border-radius: 8px;
  padding: 2.5rem;
  border: 1px solid var(--rule);
}

@media (max-width: 640px) {
  .guide-content {
    padding: 1.5rem;
  }
}

.setup-section {
  margin-bottom: 4rem;
  padding-bottom: 4rem;
  border-bottom: 2px solid var(--rule);
}

.setup-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.setup-section > h2 {
  font-size: clamp(1.75rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1.5rem 0;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-number {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.setup-section > p {
  font-size: 1.0625rem;
  line-height: 1.7;
  margin: 0 0 2rem 0;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------
   Steps
   --------------------------------------------------------------- */

.step {
  margin-bottom: 2.5rem;
}

.step:last-child {
  margin-bottom: 0;
}

.step h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--ink);
}

.step > p {
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.note {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  margin-top: 0.75rem;
}

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

.code-block {
  position: relative;
  background: #1f2937;
  border: 2px solid var(--rule);
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  color: #e5e7eb;
}

.code-block pre {
  margin: 0;
  padding: 0;
  overflow-x: auto;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
  .code-block {
    background: #0f172a;
    color: #cbd5e1;
  }

  .code-block pre {
    color: #cbd5e1;
  }
}

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

code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: #0f172a;
}

@media (prefers-color-scheme: dark) {
  code {
    background: #1e293b;
    color: #e2e8f0;
  }
}

kbd {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  font-size: 0.875em;
  background: var(--rule);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  border: 1px solid var(--ink-muted);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Copy button
   --------------------------------------------------------------- */

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
  min-width: auto;
  min-height: auto;
}

.copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.copy-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.copy-btn.copied {
  background: #10b981;
}

/* ---------------------------------------------------------------
   Checkboxes
   --------------------------------------------------------------- */

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  cursor: pointer;
  user-select: none;
  min-height: auto;
}

.step-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ink-muted);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 150ms ease-out;
  flex-shrink: 0;
  margin: 0;
  min-height: auto;
}

.step-checkbox:hover {
  border-color: var(--accent);
}

.step-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.step-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label span {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.step-checkbox:checked + span {
  color: var(--accent);
}

/* ---------------------------------------------------------------
   Completion section
   --------------------------------------------------------------- */

.completion {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 2px solid var(--rule);
}

.completion h2 {
  font-size: clamp(1.75rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  color: var(--ink);
}

.completion p {
  font-size: 1.0625rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.completion ul {
  margin: 0 0 1.5rem 0;
  padding-left: 1.5rem;
}

.completion li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.completion li:last-child {
  margin-bottom: 0;
}
@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%); }
