/* ==========================================================================
   CuzImLost — Design System
   Tokens → Base → Layout → Components → Animations → Utilities
   ========================================================================== */

/* ---- Design tokens ---- */
:root {
  /* Color */
  --bg: #07060c;
  --surface: #0d0b16;
  --surface-2: #16121f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f1f0f5;
  --text-muted: #a5a2b4;
  --text-mute-2: #8983a0;

  --accent: #7c3aed;
  --accent-bright: #a78bfa;
  --accent-2: #3b82f6;
  --cta: #7c3aed;
  --cta-bright: #a78bfa;
  --success: #22d3a7;

  --gradient-primary: linear-gradient(135deg, var(--accent) 15%, var(--accent-2) 100%);
  --gradient-cta: linear-gradient(135deg, var(--accent) 15%, var(--accent-2) 100%);

  /* Type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --fs-h1: clamp(2.25rem, 1.6vw + 1.7rem, 3.75rem);
  --fs-h2: clamp(2rem, 1.6vw + 1.5rem, 2.75rem);
  --fs-h3: clamp(1.2rem, 0.4vw + 1.05rem, 1.4rem);
  --fs-lead: clamp(1.05rem, 0.4vw + 0.95rem, 1.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-mono: 0.8rem;

  /* Space (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 999px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.2s;
  --dur-base: 0.4s;
  --dur-slow: 0.8s;

  --container: 1200px;
  --container-narrow: 780px;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; width: 100%; }
body {
  margin: 0;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.08; letter-spacing: -0.03em; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-bright); text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

.container { max-width: var(--container); margin: 0 auto; padding-inline: clamp(20px, 4vw, 40px); }
.container--narrow { max-width: var(--container-narrow); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute-2);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.eyebrow .num { color: var(--accent-bright); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-8);
}
.section-head h2 { margin-top: var(--space-2); }
.section-head p { max-width: 360px; color: var(--text-mute-2); font-size: var(--fs-small); line-height: 1.65; }

section { position: relative; padding-block: var(--space-9); }

/* ---- Buttons ---- */
.btn {
  --btn-x: 0px;
  --btn-y: 0px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  transform: translate(var(--btn-x), var(--btn-y));
  will-change: transform;
}
.btn-primary {
  background: var(--gradient-cta);
  color: #fff;
  box-shadow: 0 16px 40px -16px rgba(124, 58, 237, 0.65);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.3); }
.btn-ghost { color: var(--text-mute-2); padding: 8px 4px; }
.btn-ghost:hover { color: var(--text); }

/* ---- Header ---- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 6, 12, 0.55);
  border-bottom: 1px solid transparent;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.site-header.is-scrolled {
  background: rgba(7, 6, 12, 0.88);
  border-bottom-color: var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-7);
  height: 76px;
  padding-block: 0;
  transition: height var(--dur-base) var(--ease);
}
.site-header.is-scrolled .container { height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1rem; }
.brand img {
  width: 30px; height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.45));
  transition: width var(--dur-base) var(--ease), height var(--dur-base) var(--ease);
}
.site-header.is-scrolled .brand img { width: 24px; height: 24px; }
.main-nav { display: flex; align-items: center; gap: var(--space-6); font-size: var(--fs-small); color: var(--text-mute-2); flex: 1; }
.main-nav a {
  position: relative;
  color: inherit;
  padding-block: 4px;
}
.main-nav a::after {
  content: '';
  position: absolute;
  left: 50%; right: 50%; bottom: -2px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: left var(--dur-base) var(--ease), right var(--dur-base) var(--ease);
}
.main-nav a:hover { color: var(--text); }
.main-nav a:hover::after { left: 0; right: 0; }

.nav-cta {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  box-shadow: 0 6px 22px -10px rgba(124, 58, 237, 0.8);
  transition: filter var(--dur-fast) ease;
}
.nav-cta:hover { filter: brightness(1.1); }

/* ---- Hero ----
   Fills exactly one screen on load — nothing from the next section shows
   until you actually scroll. 100vh first as a fallback for browsers
   without support, then 100svh (small viewport height): unlike 100vh,
   svh doesn't recalculate when a mobile browser's address bar shows/hides,
   so the fold stays put instead of jumping/reflowing mid-scroll. */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 100px;
  isolation: isolate;
  overflow: hidden;
}
.aurora { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { width: 640px; height: 640px; top: -220px; left: -120px; background: radial-gradient(circle, var(--accent), transparent 70%); animation-duration: 24s; }
.aurora span:nth-child(2) { width: 560px; height: 560px; top: -80px; right: -160px; background: radial-gradient(circle, var(--accent-2), transparent 70%); animation-duration: 28s; animation-delay: -6s; }
.aurora span:nth-child(3) { width: 480px; height: 480px; bottom: -260px; left: 30%; background: radial-gradient(circle, var(--accent-2), transparent 72%); opacity: 0.34; animation-duration: 32s; animation-delay: -14s; }

.spotlight {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(560px circle at var(--sx, 50%) var(--sy, 30%), rgba(255, 255, 255, 0.06), transparent 55%);
  opacity: 0;
  transition: opacity var(--dur-base) ease;
}
.hero:hover .spotlight { opacity: 1; }

.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: var(--space-8); align-items: center; width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--accent-bright);
  margin-bottom: var(--space-4);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }

.hero h1 { font-size: var(--fs-h1); line-height: 1.12; text-wrap: balance; }
.hero h1 .word { display: inline-block; opacity: 0; transform: translateY(0.4em); animation: word-in var(--dur-slow) var(--ease) forwards; animation-delay: calc(var(--i) * 70ms); }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent-bright), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .lead { margin-top: var(--space-4); max-width: 520px; font-size: var(--fs-lead); line-height: 1.6; color: var(--text-muted); text-wrap: pretty; }
.hero .cta-row { display: flex; gap: var(--space-4); margin-top: var(--space-5); flex-wrap: wrap; }

.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.hero-visual .ring {
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.3);
  animation: spin 40s linear infinite;
}
.hero-visual .ring::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  width: 8px; height: 8px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 14px var(--accent-2);
}
.hero-visual .glow { position: absolute; width: 250px; height: 250px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 58, 237, 0.35), transparent 65%); filter: blur(20px); }
.hero-visual img { position: relative; width: 62%; max-width: 185px; filter: drop-shadow(0 24px 50px rgba(124, 58, 237, 0.3)); animation: floaty 6s ease-in-out infinite; }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-mute-2);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.scroll-hint .line { width: 1px; height: 34px; background: linear-gradient(var(--text-mute-2), transparent); animation: scroll-line 2s ease-in-out infinite; }

/* ---- Leistungen (alternating feature rows) ---- */
.feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: var(--space-8);
  align-items: center;
  padding-block: var(--space-8);
}
.feature-row + .feature-row { border-top: 1px solid var(--border); }
.feature-row.flip .feature-visual { order: 2; }
.feature-row.flip .feature-text { order: 1; }

.feature-text .tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: var(--space-5) 0; }
.feature-text .tag {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-mute-2);
}
.feature-text h3 { font-size: var(--fs-h2); margin-bottom: var(--space-4); display: flex; align-items: center; gap: 12px; }
.feature-text .status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 6px;
  vertical-align: middle;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
  color: var(--success);
}
.feature-text p.desc { color: var(--text-muted); font-size: var(--fs-lead); line-height: 1.7; max-width: 46ch; }
.feature-text .feature-link { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--space-5); font-weight: 600; color: var(--accent-bright); transition: gap var(--dur-fast) ease; }
.feature-text .feature-link:hover { gap: 11px; }

.feature-visual {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature-visual .mesh {
  position: absolute;
  inset: -30%;
  background: conic-gradient(from var(--rot, 0deg), var(--accent), var(--accent-2), var(--accent-2), var(--accent));
  filter: blur(60px);
  opacity: 0.35;
  animation: spin 18s linear infinite;
}
.feature-visual .icon {
  position: relative;
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: rgba(7, 6, 12, 0.55);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(6px);
}
.feature-visual .icon svg { width: 38px; height: 38px; stroke: var(--text); }
.feature-visual .grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

/* ---- Arbeitsweise ---- */
.process { border-radius: var(--radius-xl); border: 1px solid var(--border); padding: clamp(32px, 5vw, 64px); position: relative; overflow: hidden; background: linear-gradient(150deg, rgba(124, 58, 237, 0.08), rgba(59, 130, 246, 0.08) 55%, rgba(255, 255, 255, 0.015)); }
.process .glow { position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(59, 130, 246, 0.14), transparent 55%); pointer-events: none; }
.process-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-6); margin-top: var(--space-8); position: relative; }
.process-line { position: absolute; top: 27px; left: 5%; right: 5%; height: 2px; background: var(--border); z-index: 0; }
.process-line .fill { position: absolute; inset: 0; width: 0%; background: var(--gradient-primary); transition: width 1.2s var(--ease); }
.step { position: relative; z-index: 1; }
.step .index {
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-mute-2);
  margin-bottom: var(--space-4);
  transition: color var(--dur-base) ease, border-color var(--dur-base) ease, box-shadow var(--dur-base) ease;
}
.step.is-active .index { color: var(--accent-bright); border-color: var(--accent); box-shadow: 0 0 22px -4px rgba(124, 58, 237, 0.6); }
.step h4 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { color: var(--text-mute-2); font-size: var(--fs-small); line-height: 1.6; max-width: 32ch; }

/* ---- Stack marquee ---- */
.marquee { position: relative; margin-top: var(--space-7); overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent); mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent); }
.marquee-track { display: flex; gap: 14px; width: max-content; animation: marquee 34s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.stack-tag {
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: #cfcdda;
  white-space: nowrap;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.stack-tag:hover { border-color: var(--accent); color: var(--text); }

/* ---- Kontakt ---- */
.kontakt-panel {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(124, 58, 237, 0.25);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.13), rgba(59, 130, 246, 0.13));
  padding: clamp(48px, 8vw, 80px) clamp(24px, 6vw, 56px);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.kontakt-panel .aurora span { opacity: 0.4; }
.kontakt-panel .inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-5); }
.kontakt-panel img { width: 60px; height: 60px; object-fit: contain; filter: drop-shadow(0 0 18px rgba(124, 58, 237, 0.6)); }
.kontakt-panel h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); max-width: 640px; text-wrap: pretty; }
.kontakt-panel p { max-width: 480px; color: var(--text-muted); font-size: var(--fs-lead); }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--space-6); }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-mute-2); }
.site-footer .brand-mono { font-family: var(--font-mono); }
.footer-links { display: flex; align-items: center; gap: var(--space-5); }
.footer-links a { color: var(--text-mute-2); transition: color var(--dur-fast) ease; }
.footer-links a:hover { color: var(--accent-2); }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---- Keyframes ---- */
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.12); }
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes word-in { to { opacity: 1; transform: translateY(0); } }
@keyframes scroll-line { 0% { transform: scaleY(0); transform-origin: top; opacity: 0; } 40% { opacity: 1; } 100% { transform: scaleY(1); transform-origin: top; opacity: 0; } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- Cross-document view transitions (native, progressive enhancement) ---- */
@view-transition {
  navigation: auto;
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .reveal { opacity: 1; transform: none; }
  .hero h1 .word { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Magnetic buttons + spotlight are pointer:fine only — set up via JS gate,
   but also hide the hero glow-hover affordance on touch to avoid a stuck hover state */
@media (hover: none) {
  .hero:hover .spotlight { opacity: 0; }
}

/* ---- Responsive tweaks ---- */
@media (max-width: 720px) {
  .main-nav { display: none; }
  section { padding-block: var(--space-8); }
  .process-line { display: none; }
  /* The side graphic only fits above-the-fold on wide screens — on phones
     it would stack under the text and push the hero past one screen. */
  .hero-visual { display: none; }
}
