/*
 * Automagically-Design für pix. Die Werte stehen in docs/BRANDING.md und auf /brand; ein Test hält alle drei zusammen.
 * Hell: warmes Creme, Weiß für Karten, Schwarz für den einen Hauptknopf, ein Verlauf von Pink nach Orange als Signatur.
 */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("/_/fonts/dm-sans-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/_/fonts/dm-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/_/fonts/dm-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #efece3;
  --card: #ffffff;
  --field: #faf9f5;
  --ink: #1c1917;
  --muted: #57534e;
  --subtle: #6b655b;
  --line: #e2ddd1;
  --line-soft: #e6e1d4;
  --dot: #dcd6c8;
  --chip: #e6e1d4;
  --solid: #131316;
  --solid-ink: #ffffff;
  --pink: #e84a8a;
  --orange: #f97316;
  --ok: #16a34a;
  --err: #b42318;
  --code-bg: #131316;
  --code-ink: #e7e3d9;
  --code-tag: #f472a3;
  --code-dim: #8f897d;
  --check-a: #faf9f5;
  --check-b: #efece3;
  --shadow: 0 40px 80px -56px rgba(28, 25, 23, 0.45);
  --shadow-menu: 0 16px 36px -18px rgba(28, 25, 23, 0.4);
  --gradient: linear-gradient(135deg, var(--pink), var(--orange));
  --sans: "DM Sans", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141316; --card: #1c1b1f; --field: #17161a; --ink: #f2efe8; --muted: #b3ada3; --subtle: #9a948a;
    --line: #2e2c32; --line-soft: #26242a; --dot: #2a282e; --chip: #2c2a30;
    --solid: #f2efe8; --solid-ink: #131316; --err: #ff8a7a;
    --code-bg: #0c0c0e; --check-a: #1c1b1f; --check-b: #232126;
    --shadow: 0 40px 80px -56px rgba(0, 0, 0, 0.8); --shadow-menu: 0 16px 36px -18px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; position: relative; min-height: 100vh; color: var(--ink); background: var(--bg);
  font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
/* Punktraster oben, läuft nach unten aus */
body::before {
  content: ""; position: absolute; left: 0; right: 0; top: 68px; height: 300px; pointer-events: none;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent);
}
body > * { position: relative; }
a { color: inherit; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; border-radius: 6px; }
.defs { position: absolute; width: 0; height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Seitenkopf */
header.top {
  min-height: 68px; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px 24px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 40px; }

/* Knöpfe: ein schwarzer Hauptknopf, alles andere leise */
button, select, input { font: inherit; color: inherit; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px;
  font: 600 13.5px/1 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
button:hover, .btn:hover { border-color: var(--subtle); }
button.primary, .btn.primary { background: var(--solid); color: var(--solid-ink); border-color: var(--solid); }
button.primary:hover, .btn.primary:hover { opacity: 0.88; }
button.small { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }

/* Einstieg */
.hero { padding: 34px 0 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
h1 { margin: 0; font-size: clamp(34px, 5.4vw, 48px); line-height: 1.04; letter-spacing: -0.04em; font-weight: 700; text-wrap: balance; }
.lede { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--muted); max-width: 62ch; }

/* Reiter: eine Route je Pille */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 18px; }
.tabs button { height: auto; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--solid); color: var(--solid-ink); border-color: var(--solid); }

/* Werkbank: Formular links, Vorschau rechts, darunter Adresse und Code */
.bench { display: grid; grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.form, .preview { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.form { padding: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 14px; align-content: start; }
.preview { padding: 22px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field > label, .field > .label {
  font: 500 11px/1.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--subtle);
}
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%; min-width: 0; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--field); font: 400 14px/1.2 var(--mono);
}
.field select {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--subtle) 50%), linear-gradient(135deg, var(--subtle) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat;
}
.field input:hover, .field select:hover { border-color: var(--subtle); }
.field input:focus-visible, .field select:focus-visible { border-color: var(--pink); outline-offset: 0; }
.field.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.field.check input { width: 18px; height: 18px; accent-color: var(--pink); }
.hintline { color: var(--muted); font-size: 13px; }

/* Umschalter für kurze Auswahlen */
.segmented { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
.segmented button {
  flex: 1; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 25, 23, 0.14), 0 0 0 1px var(--line); }

.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type="text"] { flex: 1; }
.colorrow input[type="color"] {
  appearance: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; flex: none; overflow: hidden;
}
.colorrow input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.colorrow input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.colorrow input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }
.colorrow .reset { width: 40px; padding: 0; flex: none; font-size: 18px; }
.rangerow { display: flex; gap: 12px; align-items: center; }
.rangerow input { flex: 1; accent-color: var(--pink); }
.rangerow output { font-family: var(--mono); font-size: 13px; min-width: 3em; text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { height: 28px; padding: 0 8px 0 11px; font-size: 12.5px; border-radius: 999px; }
.chips .chip span { font-weight: 400; opacity: 0.7; }

.canvas {
  flex: 1; min-height: 300px; display: grid; place-items: center; padding: 24px; overflow: auto; border-radius: 14px; border: 1px solid var(--line-soft);
  background-color: var(--check-a);
  background-image: conic-gradient(var(--check-b) 25%, transparent 0 50%, var(--check-b) 0 75%, transparent 0);
  background-size: 20px 20px;
}
.canvas img { max-width: 100%; height: auto; display: block; }
.canvas.pick img { cursor: crosshair; }
.canvas .error { background: var(--card); color: var(--err); border: 1px solid var(--err); border-radius: 12px; padding: 12px 16px; max-width: 60ch; font-weight: 600; }
.sizes { display: flex; align-items: flex-end; gap: 18px; min-height: 64px; }
.sizes[hidden] { display: none; }
.sizes img { display: block; }
.sizes .note { margin-left: auto; font: 400 11px var(--mono); letter-spacing: 0.06em; color: var(--subtle); align-self: flex-end; }

/* Adresse und Code unter beiden Karten */
.urlbar, .snippet { grid-column: 1 / -1; }
.urlbar { display: flex; gap: 12px; align-items: stretch; }
.urlbox {
  flex: 1; min-width: 0; display: flex; align-items: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  font-family: var(--mono); font-size: 13px;
}
.urlbox .host { padding: 0 14px; display: flex; align-items: center; background: var(--field); border-right: 1px solid var(--line); color: var(--subtle); white-space: nowrap; }
.urlbox code { flex: 1; min-width: 0; padding: 14px 16px; font-size: 13px; overflow-wrap: anywhere; }
.urlbar > button { height: auto; min-height: 44px; border-radius: 12px; padding: 0 20px; }
.snippet { display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px 16px 22px; border-radius: 16px; background: var(--code-bg); color: var(--code-ink); }
.snippet pre { flex: 1; min-width: 0; margin: 0; font: 400 13px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet .t { color: var(--code-tag); }
.snippet .a { color: var(--code-dim); }
.snippet .s { color: #ffffff; }
.snippet .tools { display: flex; gap: 6px; flex: none; }
.snippet button { background: transparent; color: var(--code-ink); border-color: #3a3a40; }
.snippet button:hover { border-color: var(--code-ink); }
.snippet button[aria-pressed="true"] { background: #2b2a2e; border-color: #2b2a2e; }
.routes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.routes button {
  height: 26px; padding: 0 10px; border-radius: 6px; font: 500 11.5px var(--mono); background: var(--line-soft); border-color: var(--line); color: var(--muted);
}
.routes button[aria-current="true"] { background: var(--chip); color: var(--ink); border-color: var(--subtle); }

/* Unter der Werkbank: nur die gewählte Route */
.details { padding: 56px 0 8px; scroll-margin-top: 24px; }
.details h2 { margin: 0 0 8px; font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -0.035em; line-height: 1.08; }
.details .blurb { margin: 0 0 26px; color: var(--muted); max-width: 62ch; }
.details h3 { margin: 32px 0 12px; font-size: 17px; letter-spacing: -0.015em; }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.examples.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.example {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; height: auto; text-align: left; white-space: normal; background: var(--card);
  border-radius: 16px; padding: 12px; font-size: 13.5px;
}
.example .pic {
  min-height: 64px; display: flex; align-items: center; padding: 8px; border-radius: 10px; overflow: hidden; background-color: var(--check-a);
  background-image: conic-gradient(var(--check-b) 25%, transparent 0 50%, var(--check-b) 0 75%, transparent 0); background-size: 14px 14px;
}
.example .pic img { max-width: 100%; max-height: 120px; height: auto; display: block; }
table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-size: 14.5px; }
th { font: 500 11px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--subtle); background: var(--field); }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; font-family: var(--mono); font-size: 13px; font-weight: 500; }
td code { background: var(--field); border: 1px solid var(--line-soft); padding: 0 5px; border-radius: 5px; }
.table-scroll { overflow-x: auto; }
.source { margin: 18px 0 0; color: var(--muted); font-size: 14px; max-width: 72ch; }
noscript p { background: var(--card); border: 1px solid var(--err); padding: 14px 16px; border-radius: 12px; color: var(--err); font-weight: 600; }

/* Auswahl unter dem Eingabefeld: fest am Feld ausgerichtet, so breit wie das Feld */
.combo-menu {
  position: fixed; z-index: 50; margin: 0; padding: 4px; list-style: none; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-menu);
}
.combo-menu[hidden] { display: none; }
.combo-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.25; }
.combo-item .label { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-item .value { font-family: var(--mono); font-size: 12px; color: var(--subtle); flex: none; }
.combo-item:hover, .combo-item[aria-selected="true"] { background: var(--chip); }
.combo-item .swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); flex: none; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 14px; }

/* Fuß */
/* Fuß: dunkles Band über die ganze Breite, oben eine schimmernde Verlaufslinie */
body { display: flex; flex-direction: column; }
body > .wrap { flex: 1 0 auto; width: 100%; }
.foot { position: relative; margin-top: 64px; padding: 34px 40px 30px; background: #0c0c0e; color: #a8a29b; font-size: 13.5px; }
.foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background-size: 220% 100%; animation: foot-shimmer 4s linear infinite;
  background-image: linear-gradient(90deg, transparent 0%, var(--pink) 30%, var(--orange) 50%, transparent 70%);
}
@keyframes foot-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 26px; max-width: 1200px; margin: 0 auto; }
.foot-brand { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.foot-brand .mark { width: 26px; height: 26px; flex: none; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: #ffffff; }
.foot-brand b { color: #fafaf8; font-weight: 600; border-bottom: 1px solid rgba(250, 250, 248, 0.25); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.foot-note { max-width: 1200px; margin: 18px auto 0; font-size: 12.5px; line-height: 1.55; color: #8f897d; }
.prose { max-width: 68ch; padding-top: 34px; }
.prose h1 { font-size: 34px; margin: 0 0 12px; }
.prose h2 { font-size: 18px; letter-spacing: -0.015em; margin: 30px 0 6px; }
.prose p { margin: 8px 0; }
.prose a { text-decoration-color: var(--pink); text-underline-offset: 3px; }

/* Statistik */
.stats { padding-top: 34px; display: grid; gap: 14px; }
.stats h1 { font-size: 34px; margin: 0; }
.stats-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.stats-bar input[type=date] { height: 38px; padding: 0 10px; font: 400 13px var(--mono); border: 1px solid var(--line); border-radius: 11px; background: var(--field); color: var(--ink); }
.stats-btn { height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.stats-btn:hover { border-color: var(--subtle); }
.stats-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.stats-table table { border: 0; border-radius: 0; font-size: 13.5px; }
.stats-table th, .stats-table td { padding: 9px 14px; vertical-align: middle; }
.stats-path, .stats-ref { max-width: 38ch; overflow-wrap: anywhere; }
.stats-thumb { display: block; border-radius: 8px; background: var(--check-b); object-fit: contain; }
.stats-chip { font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.stats-chip.cached { background: var(--solid); color: var(--solid-ink); }
.stats-chip.bad { background: var(--err); color: var(--card); }
.stats-error { color: var(--err); }
.muted { color: var(--muted); }

@media (max-width: 900px) {
  header.top { padding: 10px 0; flex-wrap: wrap; }
  .wrap { padding: 0 16px; }
  .foot { padding: 28px 16px 26px; }
  body::before { top: 110px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; margin: 0 -16px; padding: 4px 16px 18px; }
  .tabs button { flex: none; }
  .bench { grid-template-columns: 1fr; }
  .form { padding: 20px; }
  .canvas { min-height: 220px; }
  .urlbar { flex-direction: column; }
  .urlbox .host { display: none; }
  .snippet { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .foot::before { animation: none; background-position: 50% 0; }
}
