/* =========================================================
   THE RETENTION BUILDER — Technical Blueprint
   Light "engineering documentation" aesthetic.
   One bold place: the vermilion accent = the moment a dead
   customer buys again.
   ========================================================= */

:root {
  /* --- Palette --- */
  --bg:        #f3f1ea;   /* warm technical paper */
  --bg-panel:  #fbfaf6;   /* raised cards */
  --bg-sunk:   #ebe8dd;   /* recessed / dormant */
  --fg:        #17191e;   /* ink */
  --muted:     #6a6d75;   /* secondary text */
  --faint:     #9a9c98;   /* tertiary */
  --line:      #d8d4c7;   /* hairlines / borders */
  --line-strong:#bcb8a8;
  --accent:    #df4626;   /* vermilion — the one bold signal */
  --accent-ink:#b8371c;   /* darker for text-on-light contrast */

  /* --- Type --- */
  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Code', monospace;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;

  /* --- Scale --- */
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base:1rem;
  --text-lg:  1.1875rem;
  --text-xl:  1.5rem;
  --text-2xl: 2rem;
  --display:  clamp(2.6rem, 6.4vw, 5rem);

  /* --- Rhythm --- */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 1rem;
  --space-4: 1.5rem;  --space-5: 2rem;  --space-6: 3rem;
  --space-8: 5rem;    --space-10: 7rem;

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 18px;

  --maxw: 1200px;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* faint engineering grid in the page background */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  background-position: -1px -1px;
  background-attachment: fixed;
}
/* soften the grid so it reads as texture, not a table */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, transparent 0%, var(--bg) 78%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.06; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }

a { color: inherit; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Focus (always visible) ---------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 50%; top: -100px; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 0.6rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); z-index: 100;
  font-family: var(--font-mono); font-size: var(--text-sm); text-decoration: none;
  transition: top 0.18s ease;
}
.skip-link:focus { top: 0; }

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--fg); }
.brand-mark { color: var(--fg); display: inline-flex; }
.brand-name {
  font-family: var(--font-mono); font-weight: 600;
  font-size: 0.82rem; letter-spacing: 0.12em;
}
.header-cta {
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 500;
  text-decoration: none; color: var(--fg);
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 999px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.header-cta:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.header-cta span { transition: transform 0.18s ease; }
.header-cta:hover span { transform: translateX(3px); }

/* =========================================================
   HERO
   ========================================================= */
.hero { padding-top: clamp(2.5rem, 6vw, 5rem); padding-bottom: clamp(3rem, 7vw, 6rem); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.kicker {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  letter-spacing: 0.16em; color: var(--accent-ink);
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-bottom: var(--space-4);
}
.kicker::before {
  content: ""; width: 26px; height: 1px; background: var(--accent);
}

.headline {
  font-size: var(--display);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-4);
}
.headline-accent { color: var(--accent); position: relative; white-space: nowrap; }
.headline-accent::after {
  /* hand-built underline that reads "constructed" */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0.04em; height: 0.09em;
  background: var(--accent); opacity: 0.28;
}

.subline {
  font-size: var(--text-lg);
  color: var(--muted);
  max-width: 33ch;
  margin-bottom: var(--space-5);
}

/* ---------- Form card ---------- */
.form-card {
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(23,25,30,0.4);
  position: relative;
}
.form-card::before {
  /* corner registration tick — blueprint detail */
  content: ""; position: absolute; top: 12px; right: 12px;
  width: 10px; height: 10px;
  border-top: 1.5px solid var(--line-strong); border-right: 1.5px solid var(--line-strong);
}

.form-lede { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; line-height: 1.2; margin-bottom: var(--space-2); }
.form-lede strong { color: var(--accent); font-weight: 600; }
.form-desc { color: var(--muted); font-size: var(--text-sm); margin-bottom: var(--space-4); }

.field-row { display: flex; gap: 0.6rem; }
#email {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-body); font-size: var(--text-base);
  padding: 0.85rem 1rem;
  background: var(--bg); color: var(--fg);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
#email::placeholder { color: var(--faint); }
#email:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
#email[aria-invalid="true"] { border-color: var(--accent-ink); }

.btn-primary {
  flex: 0 0 auto;
  font-family: var(--font-mono); font-weight: 600; font-size: var(--text-sm);
  letter-spacing: 0.01em;
  color: #fff; background: var(--accent);
  border: none; border-radius: var(--radius-sm);
  padding: 0.85rem 1.2rem; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  position: relative;
  transition: background 0.18s ease, transform 0.06s ease;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[aria-busy="true"] { pointer-events: none; opacity: 0.85; }
.btn-primary[aria-busy="true"] .btn-label { visibility: hidden; }
.btn-primary[aria-busy="true"] .btn-spinner { display: block; }

.btn-spinner {
  display: none; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-ink);
  margin-top: var(--space-2);
}
.micro-trust {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--faint);
  margin-top: var(--space-3); letter-spacing: 0.01em;
}

/* ---------- Success state ---------- */
.form-state[data-state="success"] { text-align: left; }
.success-check {
  width: 52px; height: 52px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); display: grid; place-items: center;
  margin-bottom: var(--space-3);
}
.success-title { font-family: var(--font-display); font-size: var(--text-xl); margin-bottom: var(--space-2); }
.success-text { color: var(--muted); font-size: var(--text-sm); margin-bottom: var(--space-4); max-width: 42ch; }
.btn-download { padding-inline: 1.3rem; }

/* =========================================================
   SIGNATURE FLOW DIAGRAM
   ========================================================= */
.hero-visual { min-width: 0; }
.flow {
  margin: 0;
  display: flex; flex-direction: column; gap: 0;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.6vw, 1.9rem);
  position: relative;
  box-shadow: 0 18px 50px -34px rgba(23,25,30,0.45);
}
.flow-caption {
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--faint);
  letter-spacing: 0.04em; margin-bottom: var(--space-3);
}

.flow-node {
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex; flex-direction: column; gap: 0.15rem;
  position: relative; z-index: 2;
}
.node-tag { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--faint); text-transform: uppercase; }
.node-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); }
.node-sub { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }

/* node character */
.node--dormant { background: var(--bg-sunk); border-style: dashed; color: var(--muted); }
.node--dormant .node-title { color: var(--muted); }
.node--ai { border-color: var(--line-strong); }
.node--ai .node-title::after { content: " ◇"; color: var(--accent); font-size: 0.8em; }
.node--win {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.node--win .node-title { color: var(--accent-ink); }

/* connectors */
.flow-link {
  position: relative;
  height: 30px; width: 2px;
  margin-left: 28px;        /* aligns connector under node padding */
  background: repeating-linear-gradient(var(--line-strong) 0 4px, transparent 4px 8px);
  z-index: 1;
}
.flow-link .pulse {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: travel 2.8s ease-in-out infinite;
}
.flow-link:nth-of-type(4) .pulse { animation-delay: 0.5s; }  /* 2nd link */
.flow-link:nth-of-type(6) .pulse { animation-delay: 1.0s; }  /* 3rd link */
@keyframes travel {
  0%   { top: -4px;  opacity: 0; }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { top: 26px;  opacity: 0; }
}

/* =========================================================
   BENEFITS
   ========================================================= */
.benefits {
  border-top: 1px solid var(--line);
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  background:
    linear-gradient(var(--bg), var(--bg));
}
.section-head { margin-bottom: var(--space-6); max-width: 34ch; }
.section-label { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-ink); letter-spacing: 0.08em; display: block; margin-bottom: var(--space-3); }
.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.02em; }

.benefit-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.benefit {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 2.5vw, 1.9rem);
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.benefit:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.benefit-num {
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600;
  color: var(--accent); display: block; margin-bottom: var(--space-3);
}
.benefit-num::before { content: "// "; color: var(--faint); }
.benefit-title { font-size: var(--text-lg); margin-bottom: var(--space-2); letter-spacing: -0.01em; }
.benefit-text { color: var(--muted); font-size: var(--text-sm); }

/* final cta */
.final-cta {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-4);
  padding: clamp(1.5rem, 3vw, 2.2rem) clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--bg-panel);
}
.final-cta-text { font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 600; letter-spacing: -0.01em; }
.final-cta .btn-primary span { transition: transform 0.18s ease; }
.final-cta .btn-primary:hover span { transform: translateX(3px); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--space-5); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.footer-brand { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--muted); }
.footer-nav { display: flex; gap: var(--space-4); }
.footer-nav .link { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--muted); text-decoration: none; }

.link {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-position: 0% 100%; background-repeat: no-repeat;
  transition: background-size 0.25s ease, color 0.18s ease;
  padding-bottom: 2px;
}
.link:hover { background-size: 100% 1px; color: var(--fg); }

/* =========================================================
   REVEAL ANIMATION
   ========================================================= */
.reveal { opacity: 0; transform: translateY(16px); animation: rise 0.7s cubic-bezier(0.22,1,0.36,1) forwards; }
.hero-copy .reveal:nth-child(1) { animation-delay: 0.05s; }
.hero-copy .reveal:nth-child(2) { animation-delay: 0.13s; }
.hero-copy .reveal:nth-child(3) { animation-delay: 0.21s; }
.hero-copy .reveal:nth-child(4) { animation-delay: 0.30s; }
.hero-visual.reveal { animation-delay: 0.32s; }
.benefit:nth-child(1) { animation-delay: 0.05s; }
.benefit:nth-child(2) { animation-delay: 0.14s; }
.benefit:nth-child(3) { animation-delay: 0.23s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: 2; }
  .subline { max-width: 46ch; }
  .benefit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .header-cta { display: none; }
  .field-row { flex-direction: column; }
  .btn-primary { width: 100%; }
  .final-cta { flex-direction: column; align-items: stretch; text-align: left; }
  .final-cta .btn-primary { width: 100%; }
  .headline-accent { white-space: normal; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  /* park the pulse mid-line as a static dot so the diagram still reads */
  .flow-link .pulse { top: 11px; opacity: 1; }
}

/* High-contrast / forced colors safety */
@media (forced-colors: active) {
  .btn-primary { border: 2px solid ButtonText; }
  .form-card, .flow, .benefit { border: 1px solid CanvasText; }
}

/* =========================================================
   LEGAL PAGES (Impressum / Datenschutz)
   ========================================================= */
.legal { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.legal-inner { max-width: 760px; }
.legal-back {
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--muted);
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem;
  margin-bottom: var(--space-5);
}
.legal h1 {
  font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; margin-bottom: var(--space-2);
}
.legal .legal-sub { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent-ink); letter-spacing: 0.08em; margin-bottom: var(--space-5); display: block; }
.legal h2 {
  font-family: var(--font-display); font-size: var(--text-xl); margin-top: var(--space-6);
  margin-bottom: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--line);
}
.legal h2:first-of-type { border-top: none; padding-top: 0; }
.legal p, .legal li { color: var(--fg); font-size: var(--text-base); margin-bottom: var(--space-3); }
.legal .muted { color: var(--muted); font-size: var(--text-sm); }
.legal ul { padding-left: 1.2rem; }
.legal .placeholder {
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-panel));
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem; font-family: var(--font-mono); font-size: 0.85em;
  color: var(--accent-ink);
}
.legal .notice {
  background: var(--bg-panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-5);
  font-size: var(--text-sm); color: var(--muted);
}
.legal a:not(.legal-back) { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
