@import url('/fonts/fonts.css');

/* ============ Design-Tokens ============ */
:root {
  --paper: #F3F0E8;
  --paper-2: #ECE8DD;
  --paper-3: #E3DED1;
  --card: #FFFFFF;
  --ink: #121211;
  --ink-2: #3F3D38;
  --ink-3: #7C786E;
  --ink-4: #A9A499;
  --line: rgba(18, 18, 17, .07);
  --line-2: rgba(18, 18, 17, .12);
  --shell: rgba(18, 18, 17, .035);
  --accent: #E4572E;
  --accent-rgb: 228, 87, 46;
  --accent-ink: #fff;
  --ok: #1D8A57;
  --ok-soft: #E3F2EA;
  --warn: #B45309;
  --warn-soft: #FBEFD9;
  --bad: #C0392B;
  --bad-soft: #F8E3E0;
  --blue: #2F6BFF;

  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-xl: 30px; --r-lg: 24px; --r-md: 18px; --r-sm: 12px; --r-xs: 9px;
  --bezel: 6px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-io: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);

  --sh-1: 0 1px 1px rgba(28, 24, 14, .04), 0 2px 6px -2px rgba(28, 24, 14, .06);
  --sh-2: 0 1px 1px rgba(28, 24, 14, .03), 0 14px 34px -16px rgba(28, 24, 14, .16), 0 40px 80px -48px rgba(28, 24, 14, .18);
  --sh-3: 0 2px 4px rgba(28, 24, 14, .04), 0 24px 60px -20px rgba(28, 24, 14, .24);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .9);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: var(--sans); font-size: 15px; line-height: 1.5; letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01', 'cv11';
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, video { max-width: 100%; display: block; }
::selection { background: rgba(var(--accent-rgb), .22); }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .7); outline-offset: 2px; border-radius: 10px; }
.ic { flex: none; display: inline-block; vertical-align: middle; }

/* Papierkorn – fest, nicht scrollend */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1000; opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ Typografie ============ */
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum', 'zero'; letter-spacing: -0.02em; }
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 11vw, 88px); line-height: .94; letter-spacing: -0.025em; margin: 0; }
.display em, .h1 em, .h2 em { font-style: italic; color: var(--ink-2); }
.h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 8.4vw, 54px); line-height: 1; letter-spacing: -0.02em; margin: 0; }
.h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(27px, 6vw, 36px); line-height: 1.05; letter-spacing: -0.015em; margin: 0; }
.h3 { font-size: 17px; font-weight: 560; letter-spacing: -0.015em; margin: 0; }
.lead { font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.story { font-family: var(--serif); font-size: 22px; line-height: 1.32; color: var(--ink); letter-spacing: -0.005em; }
.story p { margin: 0 0 .6em; } .story p:last-child { margin-bottom: 0; }
.prose p { margin: 0 0 .7em; } .prose p:last-child { margin: 0; }
.muted { color: var(--ink-3); } .small { font-size: 13px; } .tiny { font-size: 11.5px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 560; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2);
  background: var(--shell); box-shadow: inset 0 0 0 1px var(--line);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .16); }
.eyebrow.live .dot { animation: pulse 1.6s var(--ease-out) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .45) } 100% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb), 0) } }

/* ============ Doppelrand (Bezel) ============ */
.bezel { padding: var(--bezel); border-radius: var(--r-xl); background: var(--shell); box-shadow: inset 0 0 0 1px var(--line); }
.bezel > .core, .core {
  position: relative; background: var(--card); border-radius: calc(var(--r-xl) - var(--bezel));
  box-shadow: var(--hi), 0 0 0 1px rgba(18, 18, 17, .045), var(--sh-2);
}
.bezel.lg { --r-xl: 34px; }
.bezel.sm { --r-xl: 22px; --bezel: 4px; }
.core.pad { padding: 22px; } .core.pad-lg { padding: 28px; }
.card-flat { background: var(--card); border-radius: var(--r-md); box-shadow: var(--hi), 0 0 0 1px var(--line), var(--sh-1); }

/* ============ Knöpfe ============ */
.btn {
  --h: 54px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: var(--h); padding: 0 8px 0 24px; border: 0; border-radius: 999px; font-weight: 560; font-size: 15.5px; letter-spacing: -0.01em;
  background: var(--ink); color: #fff; white-space: nowrap; user-select: none; -webkit-user-select: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .14) inset, 0 10px 24px -12px rgba(18, 18, 17, .5);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, box-shadow 200ms ease, opacity 200ms ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn .knob {
  width: calc(var(--h) - 14px); height: calc(var(--h) - 14px); border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .13); transition: transform 260ms var(--ease-out), background-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) { .btn:hover .knob { transform: translate(2px, -1px) scale(1.05); } }
.btn.no-knob { padding: 0 24px; }
.btn.accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 12px 26px -12px rgba(var(--accent-rgb), .75); }
.btn.accent .knob { background: rgba(255, 255, 255, .2); }
.btn.soft { background: var(--card); color: var(--ink); box-shadow: var(--hi), 0 0 0 1px var(--line-2), var(--sh-1); }
.btn.soft .knob { background: var(--paper-2); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost .knob { background: var(--shell); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--bad); }
.btn.block { width: 100%; justify-content: space-between; }
.btn.block.center { justify-content: center; }
.btn.sm { --h: 40px; font-size: 14px; padding: 0 6px 0 16px; gap: 8px; }
.btn.sm.no-knob { padding: 0 16px; }
.btn.xs { --h: 32px; font-size: 13px; padding: 0 12px; gap: 6px; font-weight: 520; }
.btn .spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: var(--card); color: var(--ink);
  box-shadow: var(--hi), 0 0 0 1px var(--line-2), var(--sh-1); transition: transform 160ms var(--ease-out), background-color 200ms ease;
  position: relative;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn.bare { background: transparent; box-shadow: none; }
.iconbtn.sm { width: 36px; height: 36px; }
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 650; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper);
  animation: pop 420ms var(--ease-spring) both;
}
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.linkbtn { background: none; border: 0; padding: 6px 4px; color: var(--ink-3); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.linkbtn:hover { color: var(--ink); }

/* ============ Formulare ============ */
.field { display: grid; gap: 8px; }
.field > label, .label { font-size: 12px; font-weight: 560; color: var(--ink-3); letter-spacing: .02em; }
.input, .textarea, .select {
  width: 100%; min-height: 52px; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 2px rgba(18, 18, 17, .04); outline: none; font-size: 16px;
  transition: box-shadow 200ms ease, background-color 200ms ease;
}
.input:focus, .textarea:focus, .select:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 5px rgba(18, 18, 17, .06); }
.input.big { min-height: 64px; font-size: 22px; text-align: center; letter-spacing: .02em; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='%237C786E' d='M212.24 100.24l-80 80a6 6 0 0 1-8.48 0l-80-80a6 6 0 0 1 8.48-8.48L128 167.51l75.76-75.75a6 6 0 0 1 8.48 8.48Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; padding-right: 40px; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--shell); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 520; color: var(--ink-3); transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--hi), 0 0 0 1px var(--line), var(--sh-1); }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--paper-3); border: 0; transition: background-color 220ms ease; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); transition: transform 260ms var(--ease-out); }
.switch.on { background: var(--ink); } .switch.on::after { transform: translateX(18px); }

/* ============ Chips / Tags ============ */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 520; background: var(--shell); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.chip.warn { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.chip.bad { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.chip.accent { background: rgba(var(--accent-rgb), .12); color: var(--accent); box-shadow: none; }
.chip.ink { background: var(--ink); color: #fff; box-shadow: none; }

/* ============ Bewegung ============ */
.rise { animation: rise 700ms var(--ease-out) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.fade { animation: fadein 320ms var(--ease-out) both; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.stagger > * { animation: rise 640ms var(--ease-out) backwards; }
.stagger > *:nth-child(1) { animation-delay: 40ms } .stagger > *:nth-child(2) { animation-delay: 90ms } .stagger > *:nth-child(3) { animation-delay: 140ms }
.stagger > *:nth-child(4) { animation-delay: 190ms } .stagger > *:nth-child(5) { animation-delay: 240ms } .stagger > *:nth-child(6) { animation-delay: 290ms }
.stagger > *:nth-child(n+7) { animation-delay: 330ms }
.shake { animation: shake 420ms var(--ease-out); }
@keyframes shake { 10%, 90% { transform: translateX(-2px) } 20%, 80% { transform: translateX(4px) } 30%, 50%, 70% { transform: translateX(-7px) } 40%, 60% { transform: translateX(7px) } }

/* ============ Toasts ============ */
.toasts { position: fixed; left: 0; right: 0; top: calc(72px + var(--safe-t)); z-index: 900; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; max-width: 440px; width: max-content; display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; border-radius: 999px;
  background: rgba(18, 18, 17, .92); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--sh-3);
  animation: toastIn 420ms var(--ease-drawer) both;
}
.toast.ok .ic { color: #7EE2AE; } .toast.bad .ic { color: #FF9C8F; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-120%) scale(.96); } to { opacity: 1; transform: none; } }

/* ============ Sheet / Modal ============ */
.scrim { position: fixed; inset: 0; z-index: 700; background: rgba(24, 22, 16, .34); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadein 260ms ease both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 710; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 30px 30px 0 0; padding: 10px 18px calc(22px + var(--safe-b));
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .3); animation: sheetIn 480ms var(--ease-drawer) both;
}
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--ink-4); opacity: .5; margin: 2px auto 14px; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw); border-radius: 30px; transform: translate(-50%, -50%); animation: modalIn 360ms var(--ease-out) both; padding: 22px 24px 24px; }
  .sheet::before { display: none; }
  @keyframes modalIn { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
}

/* ============ Hilfen ============ */
.row { display: flex; align-items: center; gap: 12px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; }
.col { display: grid; gap: 12px; } .gap-4 { gap: 4px } .gap-6 { gap: 6px } .gap-8 { gap: 8px } .gap-16 { gap: 16px } .gap-20 { gap: 20px } .gap-24 { gap: 24px } .gap-32 { gap: 32px }
.grow { flex: 1; min-width: 0; } .center { text-align: center; } .nowrap { white-space: nowrap; } .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hr { height: 1px; background: var(--line); border: 0; margin: 4px 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skeleton { background: linear-gradient(90deg, var(--paper-2), #F7F5EF, var(--paper-2)); background-size: 200% 100%; animation: sk 1.4s linear infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0 } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .7s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.gap-10 { gap: 10px } .gap-12 { gap: 12px }
a.btn, a.iconbtn { text-decoration: none; }
