/* 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; }
}

/* ---------- Briefvorlage: Formular ---------- */
.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; }
label.button { margin: 0; }
input[type="file"].visually-hidden:focus-visible + label.button { outline: 3px solid var(--focus); outline-offset: 2px; }
.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; }
.grid-2, .grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
.grid-2 > div, .grid-3 > div { min-width: 0; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .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; }
.check { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.check label { margin: 0; font-weight: 500; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 0.75rem; min-width: 0; }
fieldset.plain legend { font-weight: 600; padding: 0; margin-bottom: 0.3rem; }
.wahl { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.hinweise { margin: 0.75rem 0 0; padding: 0.6rem 1rem 0.6rem 2rem; border-left: 4px solid var(--danger); background: var(--bg); border-radius: 0.4rem; }
.hinweise li.fehler { color: var(--danger); font-weight: 600; }
.vorschau-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.prose h2 { margin-top: 2rem; }
.table-wrap table { border-collapse: collapse; font-size: 0.95rem; }
.table-wrap th, .table-wrap td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; text-align: left; }
.table-wrap td:nth-child(n+2) { white-space: nowrap; }

/* ---------- Briefblatt A4 (alle Maße in mm ab Blattkante) ---------- */
.vorschau { display: grid; gap: 1rem; justify-items: center; margin-top: 1rem; }
.blatt-rahmen { width: calc(210mm * 0.42); height: calc(297mm * 0.42); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); background: #fff; }
.blatt-rahmen .blatt { transform: scale(0.42); transform-origin: 0 0; }
@media (min-width: 48rem) {
  .blatt-rahmen { width: calc(210mm * 0.7); height: calc(297mm * 0.7); }
  .blatt-rahmen .blatt { transform: scale(0.7); }
}
#messen { position: fixed; left: -400mm; top: 0; visibility: hidden; pointer-events: none; }
#druck { display: none; }
.blatt {
  --betreff-oben: 98.46mm; --vx: 0mm; --vy: 0mm; --falz1: 105mm; --falz2: 210mm;
  position: relative; width: 210mm; height: 297mm; overflow: hidden;
  background: #fff; color: #000; font: 11pt/1.35 Arial, Helvetica, "Liberation Sans", sans-serif;
}
.blatt > * { translate: var(--vx) var(--vy); }
.blatt p { margin: 0; max-width: none; }
.blatt .marke { position: absolute; left: 4mm; width: 5mm; border-top: 0.25mm solid #000; }
.blatt .falz1 { top: var(--falz1); }
.blatt .falz2 { top: var(--falz2); }
.blatt .loch { top: 148.5mm; width: 7mm; }
.blatt .kopf { position: absolute; right: 20mm; width: 100mm; text-align: right; }
.blatt .kopf-a { top: 7mm; font-size: 8.5pt; line-height: 1.25; }
.blatt .kopf-b { top: 12mm; font-size: 9pt; line-height: 1.3; }
.blatt .kopf-name { font-weight: 700; font-size: 1.35em; }
.blatt .kopf-a .kopf-name { font-size: 1.2em; }
.blatt .kopf-zeilen { white-space: pre-line; }
.blatt .anschriftfeld { position: absolute; left: 20mm; width: 85mm; height: 45mm; display: flex; flex-direction: column; }
.blatt .anschriftfeld[data-form="A"] { top: 27mm; padding-top: 5mm; }
.blatt .anschriftfeld[data-form="B"] { top: 45mm; }
.blatt .zusatzzone, .blatt .anschriftzone { padding: 0 5mm; overflow: hidden; }
.blatt .zusatzzone { display: flex; flex-direction: column; justify-content: flex-end; height: 17.7mm; }
.blatt .anschriftfeld[data-form="A"] .zusatzzone { height: 12.7mm; }
.blatt .anschriftzone { height: 27.3mm; }
.blatt .zeile { height: 4.23mm; line-height: 4.23mm; font-size: 10pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blatt .ruecksende { font-size: 7pt; border-bottom: 0.2mm solid #000; }
.blatt .infoblock { position: absolute; left: 125mm; width: 75mm; top: 50mm; font-size: 8pt; }
.blatt[data-form="A"] .infoblock { top: 32mm; }
.blatt .infoblock dl { margin: 0; }
.blatt .infoblock dt { line-height: 4.23mm; color: #333; }
.blatt .infoblock dd { margin: 0; line-height: 4.23mm; font-size: 10pt; }
.blatt .datumzeile { font-size: 11pt; line-height: 4.23mm; }
.blatt .inhalt { position: absolute; left: 25mm; right: 20mm; bottom: 25mm; overflow: hidden; }
.blatt .inhalt.erste { top: var(--betreff-oben); }
.blatt .inhalt.folge { top: 20mm; }
.blatt .inhalt > * { margin: 0 0 1.35em; }
.blatt .inhalt > p { white-space: pre-line; }
.blatt .betreff { font-weight: 700; margin-bottom: 2.7em; }
.blatt .gruss .unterschrift-platz { height: 14mm; }
.blatt .anlagen-titel { font-weight: 700; }
.blatt .anlagen ul { margin: 0; padding-left: 0; list-style: none; }
.blatt .seitenzahl { position: absolute; top: 10mm; left: 25mm; right: 20mm; text-align: center; font-size: 9pt; }
.blatt .fuss { position: absolute; bottom: 8mm; left: 25mm; right: 20mm; font-size: 7.5pt; line-height: 1.25; color: #333; border-top: 0.2mm solid #999; padding-top: 1mm; white-space: pre-line; }
.testblatt .rahmen { outline: 0.3mm dashed #000; }
.testblatt .zusatzzone { border-bottom: 0.2mm dotted #000; }
.testblatt .infoblock { height: 40mm; padding: 2mm; }
.testblatt .lineal { position: absolute; top: 10mm; left: 20mm; width: 100mm; height: 5mm; border-top: 0.3mm solid #000; display: flex; justify-content: space-between; }
.testblatt .lineal span { width: 0; border-left: 0.3mm solid #000; height: 4mm; font-size: 7pt; text-indent: 0.6mm; }

@media print {
  body.drucken > *:not(#druck) { display: none !important; }
  body.drucken { display: block; min-height: 0; background: #fff; }
  body.drucken #druck { display: block; }
  #druck .blatt { break-after: page; page-break-after: always; }
  #druck .blatt:last-child { break-after: auto; page-break-after: auto; }
}
@page { size: A4; margin: 0; }

/* 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; } }

/* factory:etsy-hinweis */
.factory-etsy { margin-top: 2.5rem; padding: 1.25rem 0 0.5rem; border-top: 1px solid var(--border, currentColor); }
.factory-etsy h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.factory-etsy ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.factory-etsy li { margin: 0; }
.factory-etsy li a { font-weight: 600; }
.factory-etsy .satz { display: block; color: var(--muted, inherit); font-size: 0.95rem; }
.factory-etsy .hinweis { margin: 0.75rem 0 0; color: var(--muted, inherit); font-size: 0.85rem; }
@media print { .factory-etsy { display: none; } }
