/* Halftone QR tool styles.
   The tool is a light "paper" surface inside the dark site shell: the panel is
   where the print-oriented palette lives, so the design tokens are namespaced
   `--tool-*` and the paper background, ink and serif body font are scoped to
   `.tool-page` instead of being painted onto `body`. Painting `body` (as an
   earlier standalone version of this page did) changed the background under the
   shared header and footer while their text colours stayed light-theme values,
   which made the nav and footer copy unreadable and overrode the site's
   `--accent` token for the whole document. */
.tool-page {
  --tool-paper: #f6f3ec;
  --tool-ink: #1b1a17;
  --tool-muted: #5c574d;
  --tool-line: #dcd6c8;
  --tool-card: #fffdf8;
  --tool-accent: #b4462b;
  --tool-ok: #2f6b3a;
  --tool-warn: #8f4213;

  max-width: 1180px;
  margin: 1.5rem auto 2.5rem;
  padding: 1.25rem;
  border-radius: 16px;
  background: var(--tool-paper);
  color: var(--tool-ink);
  font: 15px/1.5 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

.tool-page h1,
.tool-page h2,
.tool-page h3 {
  color: var(--tool-ink);
  font-family: inherit;
}

@media (min-width: 861px) {
  .tool-page { padding: 1.75rem; }
}

.tool-hero {
  padding: 0 0 0.5rem;
}

.tool-hero h1 { margin: 0; font-size: 2rem; letter-spacing: -0.01em; }
.tool-hero h1 span { color: var(--tool-accent); }
.tool-hero .lede { max-width: 760px; margin: 0.4rem 0 0; color: var(--tool-muted); }

.tool-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem 0 0;
}

@media (max-width: 860px) {
  .tool-shell { grid-template-columns: 1fr; }
}

.tool-panel,
.tool-preview {
  background: var(--tool-card);
  border: 1px solid var(--tool-line);
  border-radius: 10px;
  padding: 1.1rem;
}

.tool-panel { display: grid; gap: 0.85rem; align-content: start; }
.tool-preview { display: grid; gap: 0.9rem; }

.field { display: grid; gap: 0.3rem; }
.field > span {
  font: 600 11px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tool-muted);
}
.field small { color: var(--tool-muted); font: 12px/1.4 system-ui, sans-serif; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

textarea,
select,
input[type="file"],
input[type="color"] {
  width: 100%;
  font: 14px/1.4 ui-monospace, Menlo, Consolas, monospace;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--tool-line);
  border-radius: 6px;
  background: #fff;
  color: var(--tool-ink);
}

select { font-family: system-ui, sans-serif; }
input[type="color"] { height: 2.2rem; padding: 0.15rem; }
input[type="range"] { width: 100%; accent-color: var(--tool-accent); }

/* Checkbox rows are labels, so the whole 24px-minimum row is the hit target. */
.check {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 24px;
  padding: 0.2rem 0;
  font: 13px/1.4 system-ui, sans-serif;
  cursor: pointer;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px solid var(--tool-line);
  border-radius: 8px;
  background: #fff;
  padding: 0.75rem;
  /* The canvas is painted at 2x for the preview; let it shrink to the panel
     instead of overflowing it on a narrow screen. */
  overflow: hidden;
}

.stage canvas {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.status { font: 13px/1.5 system-ui, sans-serif; color: var(--tool-muted); margin: 0; }
.error {
  font: 13px/1.5 system-ui, sans-serif;
  color: var(--tool-warn);
  background: #fbf1e8;
  border: 1px solid #e2b48f;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin: 0;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.tool-page button {
  font: 600 14px system-ui, sans-serif;
  min-height: 36px;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  border: 1px solid var(--tool-ink);
  background: var(--tool-ink);
  color: #fff;
  cursor: pointer;
}

.tool-page button.alt { background: transparent; color: var(--tool-ink); }
.tool-page button:disabled { opacity: 0.55; cursor: default; }

.tool-page details { font: 14px/1.6 system-ui, sans-serif; color: #3c3933; }
.tool-page details summary { cursor: pointer; font-weight: 600; }

/* Keyboard focus must stay visible on the light panel; the shell's
   `:focus-visible` ring is --cta, which is only 3.4:1 on the paper surface. */
.tool-page :focus-visible {
  outline: 2px solid var(--tool-accent);
  outline-offset: 2px;
}
