/* ============================================================
   DEPESCHE — Design-System (Risograph-Dispatch)
   Kraftpapier · Fluor-Pink + Riso-Kobalt · Halbton · Stempel
   ============================================================ */

/* ---------- Fonts (lokal, DSGVO) ---------- */
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('../fonts/spacegrotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'Hanken Grotesk'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('../fonts/hankengrotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'Spline Sans Mono'; font-style: normal; font-weight: 400 500;
  font-display: swap; src: url('../fonts/splinesansmono.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  --papier: #e8e5dc;
  --papier-2: #dedacd;
  --papier-3: #f2f0e9;      /* Karten-Weiß auf Papier */
  --tinte: #17151c;
  --tinte-60: #57525f;
  --tinte-40: #8b8794;
  --fluor: #ff3d8b;
  --fluor-tief: #e21f70;
  --kobalt: #2338cc;
  --kobalt-tief: #1a2ba3;
  --overprint: #6b1f9e;
  --erfolg: #1f8a54;
  --warn: #d98016;
  --fehler: #cc3344;

  --radius: 12px;
  --radius-s: 8px;
  --radius-pill: 999px;
  --linie: rgba(23,21,28,.14);
  --linie-stark: rgba(23,21,28,.28);
  --schatten: 0 1px 0 var(--linie), 0 14px 30px -22px rgba(23,21,28,.5);
  --schatten-hover: 0 1px 0 var(--linie-stark), 0 20px 40px -24px rgba(23,21,28,.55);

  --ff-display: 'Space Grotesk', system-ui, sans-serif;
  --ff-body: 'Hanken Grotesk', system-ui, sans-serif;
  --ff-mono: 'Spline Sans Mono', ui-monospace, monospace;

  --maxw: 1180px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--tinte);
  font-family: var(--ff-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--ff-display); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 4.2rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
p { margin: 0 0 1em; }
a { color: var(--kobalt); text-decoration: none; }
a:hover { color: var(--kobalt-tief); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--kobalt); outline-offset: 2px; border-radius: 4px; }

/* ---------- Mono-Label / Eyebrow ---------- */
.mono { font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow { font-family: var(--ff-mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fluor-tief); display: inline-flex; align-items: center; gap: .5em; }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--fluor); display: inline-block; }

/* ---------- Halbton (CSS-Raster, kein Bild) ---------- */
.halbton { position: relative; }
.halbton::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: radial-gradient(var(--tinte) 1px, transparent 1.4px);
  background-size: 7px 7px; opacity: .06; mix-blend-mode: multiply;
}
.halbton-pink::after { background-image: radial-gradient(var(--fluor) 1.1px, transparent 1.5px); opacity: .14; }
.halbton-kobalt::after { background-image: radial-gradient(var(--kobalt) 1.1px, transparent 1.5px); opacity: .12; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(18px, 4vw, 40px); }
.section { padding-block: clamp(48px, 8vw, 100px); position: relative; }
.perf-top { border-top: 2px dashed var(--linie-stark); }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--fluor); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  padding: .82em 1.5em; border-radius: var(--radius-pill); border: 1.5px solid var(--tinte);
  background: var(--bg); color: var(--fg); font-family: var(--ff-body); font-weight: 700;
  font-size: .98rem; cursor: pointer; text-decoration: none; line-height: 1;
  box-shadow: 3px 3px 0 var(--tinte); transition: transform .16s var(--ease), box-shadow .16s var(--ease), background .2s;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--tinte); color: #fff; }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--tinte); }
.btn--kobalt { --bg: var(--kobalt); }
.btn--ink { --bg: var(--tinte); }
.btn--ghost { --bg: transparent; --fg: var(--tinte); box-shadow: none; }
.btn--ghost:hover { --fg: var(--tinte); background: rgba(23,21,28,.06); box-shadow: none; transform: none; }
.btn--sm { padding: .55em 1em; font-size: .85rem; box-shadow: 2px 2px 0 var(--tinte); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Karten ---------- */
.card {
  background: var(--papier-3); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 28px); box-shadow: var(--schatten); position: relative;
}
.card--hover { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--schatten-hover); }

/* ---------- Chips / Stempel ---------- */
.chip {
  display: inline-flex; align-items: center; gap: .4em; padding: .28em .7em;
  border-radius: var(--radius-pill); font-family: var(--ff-mono); font-size: .68rem;
  letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor;
}
.chip--ok { color: var(--erfolg); } .chip--warn { color: var(--warn); }
.chip--err { color: var(--fehler); } .chip--info { color: var(--kobalt); }
.chip--muted { color: var(--tinte-40); }

.stempel {
  display: inline-flex; align-items: center; gap: .5em; padding: .4em 1em;
  border: 2.5px solid var(--kobalt); color: var(--kobalt); border-radius: 6px;
  font-family: var(--ff-display); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  transform: rotate(-4deg); font-size: .9rem;
}
.stempel--fluor { border-color: var(--fluor-tief); color: var(--fluor-tief); }

/* ---------- Inputs ---------- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: .7em .85em; background: #fff; color: var(--tinte);
  border: 1.5px solid var(--linie-stark); border-radius: var(--radius-s); font-size: .98rem;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--kobalt); box-shadow: 0 0 0 3px rgba(35,56,204,.16); }
.textarea { min-height: 120px; resize: vertical; font-family: var(--ff-mono); font-size: .9rem; line-height: 1.55; }
.hint { font-size: .8rem; color: var(--tinte-60); margin-top: 5px; }
.field-error { color: var(--fehler); font-size: .82rem; margin-top: 5px; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--tinte-60); padding: 10px 12px; border-bottom: 2px solid var(--linie-stark); }
.table td { padding: 12px; border-bottom: 1px solid var(--linie); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(23,21,28,.03); }
.table-scroll { overflow-x: auto; }

/* ---------- KPI-Kacheln ---------- */
.kpi { display: grid; gap: 6px; }
.kpi .num { font-family: var(--ff-display); font-weight: 700; font-size: clamp(1.8rem, 3.5vw, 2.6rem); line-height: 1; }
.kpi .lbl { font-family: var(--ff-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--tinte-60); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 1000; }
.toast {
  background: var(--tinte); color: #fff; padding: 12px 16px; border-radius: var(--radius-s);
  box-shadow: 3px 3px 0 var(--fluor); font-size: .9rem; display: flex; align-items: center; gap: .6em;
  animation: toast-in .4s var(--ease);
}
.toast--ok { box-shadow: 3px 3px 0 var(--erfolg); }
.toast--err { box-shadow: 3px 3px 0 var(--fehler); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Reveal (eigener Rhythmus: Aufstieg + Ink-Versatz) ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-i] { transition-delay: calc(var(--d, 70) * 1ms * attr(data-i number, 0)); }

/* ---------- Stempel-Thunk (Signature) ---------- */
@keyframes stamp-thunk {
  0% { transform: rotate(-4deg) scale(1.5); opacity: 0; }
  55% { transform: rotate(-4deg) scale(.92); opacity: 1; }
  100% { transform: rotate(-4deg) scale(1); opacity: 1; }
}
.thunk { animation: stamp-thunk .34s var(--ease) both; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--tinte-40); border-radius: 999px; border: 3px solid var(--papier); }

/* ---------- Utilities ---------- */
.stack { display: grid; gap: var(--g, 16px); }
.row { display: flex; gap: var(--g, 12px); align-items: center; }
.between { justify-content: space-between; }
.wrap-row { flex-wrap: wrap; }
.muted { color: var(--tinte-60); }
.grow { flex: 1; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
