/* QR-Code-Generator – Farben passend zum Portfolio: Akzent #0057FF, Sand #E8DED3 */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f3ece3;       /* helles Sand */
  --field-bg: #ffffff;
  --sand: #e8ded3;
  --text: #111111;
  --muted: #4b4f57;
  --border: #857868;
  --accent: #0057ff;
  --accent-ink: #ffffff;     /* Schrift auf Akzentflächen */
  --accent-text: #0047d1;    /* Links/Text in Akzentfarbe */
  --focus: #0057ff;
  --warn-bg: #fff4d6;
  --warn-border: #b26b00;
  --warn-text: #5c3b00;
  --ok-text: #0b5f2a;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #171b22;
    --field-bg: #0e1116;
    --sand: #e8ded3;
    --text: #ececec;
    --muted: #b0b7c2;
    --border: #6b7686;
    --accent: #0057ff;
    --accent-ink: #ffffff;
    --accent-text: #8fb4ff;
    --focus: #8fb4ff;
    --warn-bg: #2b2210;
    --warn-border: #d99a2b;
    --warn-text: #ffd98a;
    --ok-text: #7be3a0;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

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

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

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 6px;
}
.skip-link:focus { top: 8px; }

/* Kopf */
.site-header {
  background: var(--sand);
  color: #111111;
  padding: 28px 0 24px;
}
.site-header h1 {
  margin: 0 0 4px;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.lead { margin: 0; max-width: 60ch; color: #2b2b2b; }

/* Datenschutz-Hinweis */
.privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
  padding: 12px 14px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
}
.privacy-icon { flex: none; margin-top: 2px; color: var(--accent-text); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
@media (min-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: start; }
  .preview { position: sticky; top: 16px; }
}

.panel {
  min-width: 0;
  padding: 18px 16px 20px;
  background: var(--surface);
  border-radius: var(--radius);
}
.panel h2 { margin: 0 0 12px; font-size: 1.2rem; line-height: 1.3; }
.panel .sub-h { margin-top: 26px; }

/* Formularfelder */
fieldset { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 600; }

.field { margin-bottom: 14px; min-width: 0; }
.field > label:not(.check) { display: block; margin-bottom: 4px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
@media (min-width: 520px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  font: inherit;
  color: var(--text);
  background: var(--field-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
}
textarea { resize: vertical; min-height: 6.5rem; }
::placeholder { color: var(--muted); opacity: 1; }

input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }

.hint { margin: 6px 0 0; font-size: 0.875rem; color: var(--muted); }

/* Segment-Auswahl (Radio-Buttons) */
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { position: relative; display: block; }
.seg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg span {
  display: block;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--field-bg);
  font-weight: 600;
  line-height: 1.4;
}
.seg:hover span { border-color: var(--accent-text); }
.seg input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.seg input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Farben */
.colors { align-items: end; }
.color-wrap { display: flex; align-items: center; gap: 10px; }
input[type="color"] {
  width: 56px;
  height: 44px;
  padding: 3px;
  background: var(--field-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.color-wrap code { font-size: 0.95rem; }

/* Buttons */
.btn {
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--field-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent-text); }
.btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #0046cc; border-color: #0046cc; }
.btn-ghost { font-weight: 500; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 auto; }

/* Vorschau */
.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-box {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
  line-height: 0;
}
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-box[hidden] { display: none; }
.qr-empty {
  width: 100%;
  max-width: 340px;
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--border);
  border-radius: 8px;
}
.qr-empty[hidden] { display: none; }

.qr-info { margin: 10px 0 0; text-align: center; font-size: 0.9rem; color: var(--muted); min-height: 1.4em; }

.notes { list-style: none; margin: 10px 0 0; padding: 0; }
.notes li {
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 5px solid var(--warn-border);
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.925rem;
}
.notes li.error { font-weight: 600; }

.status { min-height: 1.5em; margin: 10px 0 0; font-weight: 600; color: var(--ok-text); }

.payload { margin-top: 14px; }
.payload summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.payload pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Fuß */
.site-footer { border-top: 1px solid var(--border); padding: 18px 0 28px; }
.site-footer p { margin: 0 0 6px; }
.site-footer .small { font-size: 0.85rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
