/* Claw Labs Factory – Basis-Stylesheet. Systemschriften, hell/dunkel, ohne externe Ressourcen. */
:root {
  color-scheme: light dark;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text: #1c1c1f;
  --muted: #55565f;
  --border: #dedbd4;
  --accent: #0b6b66;
  --accent-text: #ffffff;
  --accent-soft: #e2f1ef;
  --focus: #b54708;
  --danger: #b42318;
  --radius: 0.75rem;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1c1f;
    --text: #ececee;
    --muted: #a9abb3;
    --border: #2f3236;
    --accent: #5ccac1;
    --accent-text: #0b1513;
    --accent-soft: #15302d;
    --focus: #f7b267;
    --danger: #f97066;
    --shadow: none;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--font);
  min-height: 100vh;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.wrap { width: min(100% - 2rem, 60rem); margin-inline: auto; }

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  border-radius: 0.5rem;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.5em;
  border-radius: 0.2em;
  background: var(--accent);
  vertical-align: 0.02em;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; -webkit-hyphens: auto; hyphens: auto; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.75rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
p, li { max-width: 68ch; }

.hero { padding: clamp(2.5rem, 7vw, 4.5rem) 0 1.5rem; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin: 1.5rem 0;
}
.card > h2:first-child { margin-top: 0; }

label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
textarea, input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}
textarea { resize: vertical; min-height: 8rem; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 0.4rem 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
}
.button.secondary { background: transparent; color: var(--accent); border-color: var(--accent); }

.result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.result li {
  background: var(--accent-soft);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
}
.result .value { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .label { color: var(--muted); font-size: 0.9rem; }

.steps { padding-left: 1.25rem; }
.steps li { margin: 0.35rem 0; }

code, pre { font-family: var(--mono); font-size: 0.92em; }
pre { overflow-x: auto; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; }

/* Breite Tabellen: <div class="table-wrap" tabindex="0" role="region" aria-label="…"><table>…</table></div> */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 0.5rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

.notice {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.9rem 1.1rem;
  border-radius: 0 0.5rem 0.5rem 0;
}

.legal { padding: 2.5rem 0 1rem; }
.legal h1 { font-size: clamp(1.6rem, 6.5vw, 2rem); }
.legal a { overflow-wrap: anywhere; }
.legal h2 { font-size: 1.15rem; margin-top: 1.75rem; }
.legal-meta { color: var(--muted); font-size: 0.9rem; margin-top: 2.5rem; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.legal-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0 0 0.75rem; }
.legal-links a { color: var(--muted); }
.legal-links a[aria-current="page"] { color: var(--text); font-weight: 600; }
.fine { margin: 0; font-size: 0.875rem; }

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

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Etiketten-Druck ---------- */
.site-header .wrap { flex-wrap: wrap; gap: 0.25rem 1rem; padding-block: 0.5rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.25em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nr { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin-right: 0.5em; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.8em; vertical-align: 0.1em; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 0; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
label.button { margin: 0; }
input[type="file"].visually-hidden:focus-visible + label.button { outline: 3px solid var(--focus); outline-offset: 2px; }
.ablage { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.ablage.ueber { border-color: var(--accent); background: var(--accent-soft); }
.status { margin: 0.6rem 0 0; min-height: 1.2em; }
.status[data-kind="ok"] { color: var(--accent); }
.status[data-kind="warn"] { color: var(--danger); font-weight: 600; }
details.einfuegen, details.optionen { margin-top: 1rem; }
details > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details[open] > summary { margin-bottom: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
@media (min-width: 40rem) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); flex: none; margin: 0.15rem 0 0; padding: 0; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 0.6rem; }
.check label { margin: 0; font-weight: 500; }
.klein { display: block; color: var(--muted); font-size: 0.88rem; font-weight: 400; }
h3 .klein { display: inline; margin-left: 0.4rem; }
fieldset.gruppe { border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.75rem 1rem 1rem; margin: 0 0 1rem; min-width: 0; }
fieldset.gruppe legend { font-weight: 600; padding: 0 0.3rem; }
.text dt { font-weight: 700; margin-top: 0.8rem; }
.text dd { margin-left: 0; }
.grid-2, .grid-4 { display: grid; grid-template-columns: 1fr; gap: 0.75rem 1rem; margin: 0.75rem 0; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.grid-3 { margin-top: 1rem; }
.feld-titel { font-weight: 600; margin: 1rem 0 0.4rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { font: inherit; font-size: 0.92rem; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); cursor: pointer; }
textarea:disabled { opacity: 0.6; }
.hinweise { margin: 0.5rem 0; padding-left: 1.2rem; color: var(--danger); font-weight: 600; }
.hinweise:empty { display: none; }
section > details { border-bottom: 1px solid var(--border); padding: 0.6rem 0; }
section > details p { margin: 0.5rem 0 0.25rem; }

/* Vorschau: Bögen in echter Größe (mm), per JS auf die Breite skaliert */
.bogen { margin-top: 1rem; display: grid; gap: 1rem; justify-items: center; }
.blatt-rahmen { overflow: hidden; box-shadow: 0 1px 6px rgb(0 0 0 / 0.25); background: #fff; }
.blatt { position: relative; width: 210mm; height: 297mm; background: #fff; color: #000; transform-origin: 0 0; overflow: hidden; }
.etikett { position: absolute; overflow: hidden; outline: 1px dashed #b9c4c3; outline-offset: -1px; }
.etikett.zu-voll { outline: 2px solid #c4320a; }
.inhalt { width: 100%; height: 100%; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-start;
  font-family: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", sans-serif; line-height: 1.2; color: #000; }
.mittig .inhalt { justify-content: safe center; }
.inhalt > div { white-space: nowrap; overflow: hidden; }
.zentriert .inhalt { text-align: center; }
.erste-fett .inhalt > div:first-child { font-weight: 700; }
.mit-rahmen .etikett { outline: 0.2mm solid #000; outline-offset: -0.2mm; }

@page { size: A4 portrait; margin: 0; }
@media print {
  body { display: block; min-height: 0; }
  body > :not(main), main > :not(.druckbereich), .druckbereich > :not(.bogen) { display: none !important; }
  main.wrap { width: auto; margin: 0; }
  .druckbereich { border: 0; padding: 0; margin: 0; box-shadow: none; background: none; }
  .bogen { display: block; margin: 0; }
  .blatt-rahmen { width: auto !important; height: auto !important; box-shadow: none; overflow: visible; break-after: page; }
  .blatt-rahmen:last-child { break-after: auto; }
  .blatt { transform: none !important; }
  .etikett, .etikett.zu-voll { outline: 0; }
  .mit-rahmen .etikett { outline: 0.2mm solid #000; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
[hidden] { display: none !important; }
.bogen { overflow: hidden; }
.blatt-rahmen { max-width: 100%; }
@media print { .bogen { overflow: visible; } .blatt-rahmen { max-width: none; } }

/* factory:weitere-werkzeuge */
.factory-related { margin-top: 2.5rem; padding: 1.5rem 0 0.75rem; border-top: 1px solid var(--border, currentColor); }
.factory-related h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.factory-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.factory-related li { margin: 0; }
.factory-related li a { font-weight: 600; }
.factory-related .tagline { display: block; color: var(--muted, inherit); font-size: 0.95rem; }
.factory-related .alle { margin: 1rem 0 0; }
@media (min-width: 48rem) { .factory-related ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .factory-related { display: none; } }
