/* Buchkodex Studio: gemeinsame Gestaltungsgrundlagen (Phase 0).
   Stränge ergänzen eigene Dateien (interview.css, konzept.css, werkstatt.css, downloads.css, admin.css)
   und nutzen nur diese Variablen und Bausteine. Mobil zuerst, ab 760 px breiter. */

@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/poppins-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* Marke (wie buchkodex.de) */
  --bk-red: #e11928;
  --bk-red-dark: #b81521;
  --bk-red-soft: #fde8ea;
  --ink: #17191d;
  --ink-2: #24262b;
  --ink-3: #3a3d44;
  --muted: #5c6068;
  --muted-2: #7a7f88;
  --line: #e8e1d9;
  --paper: #f7f3ee;
  --paper-2: #fbf9f6;
  --white: #ffffff;
  --ok: #1f7a4d;
  --ok-soft: #e4f3ea;
  --warn: #9a5b00;
  --warn-soft: #fdf0dc;
  --err: #b3261e;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: "Poppins", "Inter", -apple-system, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(23, 25, 29, 0.08);
  --shadow-lg: 0 24px 60px rgba(23, 25, 29, 0.14);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --content: 720px;
  --wide: 1080px;
  --tap: 48px; /* Mindesthöhe für Bedienelemente */
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--bk-red-dark); text-underline-offset: 3px; }
a:hover { color: var(--bk-red); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 var(--space-3); color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 5vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 3.6vw, 1.85rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 var(--space-4); }
small, .small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid rgba(225, 25, 40, 0.45); outline-offset: 2px; }

/* Rahmen */
.container { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--space-4); }
.container--narrow { max-width: var(--content); }
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: var(--space-4); }
@media (min-width: 760px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Kopfzeile */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: var(--space-3); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.04em; color: var(--ink); text-decoration: none; font-size: 1rem; }
.brand__mark { width: 14px; height: 14px; background: var(--bk-red); border-radius: 2px; }
.brand__sub { font-weight: 500; letter-spacing: 0; color: var(--muted); font-family: var(--font); font-size: 0.9rem; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }
.topbar__actions .topbar__admin { color: var(--muted); text-decoration: none; margin-right: var(--space-2); }
.topbar__actions .topbar__admin:hover { color: var(--ink); text-decoration: underline; }
/* „Meine Bücher“ und Hinweis auf das nächste Buch (07.10.2026) */
.topbar__actions .topbar__books { color: var(--ink); text-decoration: none; margin-right: var(--space-2); font-weight: 600; }
.topbar__actions .topbar__books:hover { text-decoration: underline; }
@media (max-width: 420px) { .topbar .brand__sub { display: none; } .topbar__actions .topbar__books { white-space: nowrap; } }
.naechstes-buch h2 { margin-bottom: 0; }
.naechstes-buch p { margin-bottom: 0; }
.naechstes-buch form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.ws-next { max-width: var(--content); margin: var(--space-6) auto 0; }
.naechstes { max-width: var(--wide); margin: 0 auto; padding-top: var(--space-5); }
.naechstes__back { text-align: center; }

/* Schrittleiste */
.steps { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-3) 0; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.step { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; font-size: 0.875rem; font-weight: 500; color: var(--muted); background: transparent; text-decoration: none; border: 1px solid var(--line); }
.step__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.step--done { color: var(--ink-3); }
.step--done .step__dot { background: var(--ok); }
.step--current { color: var(--white); background: var(--ink); border-color: var(--ink); }
.step--current .step__dot { background: var(--bk-red); }
a.step:hover { border-color: var(--ink-3); color: var(--ink); }

/* Hauptbereich */
.main { padding: var(--space-5) 0 var(--space-8); }
.page-head { margin-bottom: var(--space-5); }
.page-head p { color: var(--muted); max-width: 60ch; }

/* Karten */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); }
.card--flat { box-shadow: none; }
.card--highlight { border-color: var(--bk-red); box-shadow: 0 0 0 3px var(--bk-red-soft), var(--shadow); }
.card__title { font-family: var(--font-head); font-weight: 600; font-size: 1.1rem; margin-bottom: var(--space-2); }

/* Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 1rem/1 var(--font); cursor: pointer; text-decoration: none; transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: 0.6; cursor: not-allowed; }
.btn--primary { background: var(--bk-red); color: var(--white); box-shadow: 0 8px 20px rgba(225, 25, 40, 0.25); }
.btn--primary:hover { background: var(--bk-red-dark); color: var(--white); }
.btn--dark { background: var(--ink); color: var(--white); }
.btn--dark:hover { background: var(--ink-2); color: var(--white); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn--link { background: none; border: 0; padding: 0; min-height: auto; color: var(--bk-red-dark); text-decoration: underline; font-weight: 500; }
.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 1.05rem; padding: 0 28px; }

/* Formulare */
.field { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: 0.95rem; }
.hint { font-size: 0.875rem; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: var(--tap); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 400 1rem/1.5 var(--font); color: var(--ink); background: var(--white);
}
.textarea { min-height: 140px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink-3); outline: none; box-shadow: 0 0 0 3px rgba(23, 25, 29, 0.08); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 0.9rem; color: var(--ink-3); }
.checkbox input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--bk-red); }
.form-error { color: var(--err); font-size: 0.9rem; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Hinweise */
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--paper-2); border: 1px solid var(--line); font-size: 0.95rem; }
.notice--ok { background: var(--ok-soft); border-color: #bfe3cd; }
.notice--warn { background: var(--warn-soft); border-color: #f2d5a8; }
.notice--err { background: #fdecea; border-color: #f5c2bd; color: #7a1a12; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--paper); border: 1px solid var(--line); color: var(--ink-3); }
.badge--red { background: var(--bk-red-soft); border-color: #f7c4c9; color: var(--bk-red-dark); }
.badge--ok { background: var(--ok-soft); border-color: #bfe3cd; color: var(--ok); }

/* Fortschritt */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--bk-red), #ff5a3c); border-radius: inherit; transition: width 0.4s ease; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(23, 25, 29, 0.12); border-top-color: var(--bk-red); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Aufnahmeknopf (Interview und Änderungen per Sprache) */
.record-btn {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--bk-red); color: var(--white); box-shadow: 0 14px 34px rgba(225, 25, 40, 0.35); transition: transform 0.1s, box-shadow 0.2s;
}
.record-btn svg { width: 36px; height: 36px; }
.record-btn.is-recording { background: var(--ink); box-shadow: 0 0 0 10px rgba(225, 25, 40, 0.18), 0 14px 34px rgba(23, 25, 29, 0.35); animation: rec 1.4s ease-in-out infinite; }
@keyframes rec { 0%, 100% { box-shadow: 0 0 0 8px rgba(225, 25, 40, 0.18), 0 14px 34px rgba(23, 25, 29, 0.3); } 50% { box-shadow: 0 0 0 18px rgba(225, 25, 40, 0.08), 0 14px 34px rgba(23, 25, 29, 0.3); } }

/* 3D-Buch für Cover-Vorschau (Konzept, Downloads) */
.book3d { perspective: 1200px; display: inline-block; }
.book3d__inner { position: relative; transform: rotateY(-24deg); transform-style: preserve-3d; transition: transform 0.4s; }
.book3d:hover .book3d__inner { transform: rotateY(-14deg); }
.book3d__front { display: block; width: 220px; aspect-ratio: 148 / 210; object-fit: cover; border-radius: 2px 6px 6px 2px; box-shadow: var(--shadow-lg); }
.book3d__inner::after { content: ""; position: absolute; top: 2%; right: -14px; width: 14px; height: 96%; background: repeating-linear-gradient(0deg, #f3efe8 0 2px, #e6dfd3 2px 3px); transform: rotateY(90deg) translateZ(-7px); transform-origin: left; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 460px); }
.toast { background: var(--ink); color: var(--white); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 0.95rem; }
.toast--err { background: var(--err); }

/* Feedback-Knopf und Dialog (Strang H). Unten rechts, über dem Seitenende und der Sicherheitszone des Handys.
   Auf schmalen Bildschirmen nur das Symbol, damit Aufnahme- und Kaufknöpfe frei bleiben. */
.fb-open {
  position: fixed; z-index: 40;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px 0 12px;
  border: 1px solid rgba(23, 25, 29, 0.12); border-radius: 999px;
  background: var(--ink); color: var(--white);
  font: 600 0.9rem/1 var(--font); cursor: pointer;
  box-shadow: 0 12px 30px rgba(23, 25, 29, 0.22);
  -webkit-tap-highlight-color: transparent;
}
.fb-open:hover { background: var(--ink-2); }
.fb-open svg { width: 22px; height: 22px; flex: none; }
.fb-dialog {
  width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.fb-dialog::backdrop { background: rgba(23, 25, 29, 0.45); }
.fb-dialog__box { padding: var(--space-5); }
.fb-dialog h2 { font-size: 1.35rem; margin-bottom: var(--space-2); }
.fb-dialog__lead { color: var(--muted); font-size: 0.95rem; }
.fb-dialog .label { display: block; margin-bottom: 6px; }
.fb-dialog .textarea { min-height: 150px; }
.fb-dialog .form-error { margin: var(--space-2) 0 0; }
.fb-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.fb-done { margin: 0; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--ok-soft); border: 1px solid #bfe3cd; color: var(--ink); font-weight: 500; }
.fb-done p { margin: 0 0 var(--space-2); font-weight: 400; }
.fb-done p:last-child { margin-bottom: 0; }
.fb-done strong { font-weight: 600; }
@media (max-width: 759px) {
  .fb-open { width: 46px; height: 46px; padding: 0; justify-content: center; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
  .fb-open__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* Fester Kaufknopf im Buchkonzept (konzept.css): Feedback darüber, nicht darauf */
  body:has(.kz-sticky:not([hidden])) .fb-open { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fb-dialog__box { padding: var(--space-4); }
  .fb-actions { flex-direction: column; }
  .fb-actions .btn { width: 100%; }
}
@media print { .fb-open, .fb-dialog { display: none !important; } }

/* Fußzeile */
.footer { border-top: 1px solid var(--line); padding: var(--space-5) 0; color: var(--muted); font-size: 0.875rem; }
body[data-report-errors] .footer { padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom)); }
.footer a { color: var(--muted); }
.footer__links { display: flex; gap: var(--space-4); flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
