:root {
  --bg: #0d0f12;
  --fg: #edeced;
  --muted: #8a8f98;
  --border: rgba(237, 237, 236, 0.1);
  --border-strong: rgba(237, 237, 236, 0.18);

  --accent-1: #ff9a3c;
  --accent-2: #e1432d;
  --accent-3: #12b58a;

  /* System font stack only — no Google Fonts, no third-party requests, no
     GDPR exposure from loading fonts off an external server. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --content-width: 720px;
  --gutter: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Cursor-following gradient layer -------------------------------------- */

.gradient-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
  animation: hue-drift 48s ease-in-out infinite;
}

@keyframes hue-drift {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
  .gradient-layer {
    animation: none;
  }
}

@media (hover: none) {
  .gradient-layer {
    animation: none;
  }
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  transform: translate(-50%, -50%);
}

/* iOS Safari in particular is known to recompute `filter: blur()` on
   `position: fixed` elements on every scroll frame instead of once —
   combined with backdrop-filter this can make the whole browser chrome
   stutter, not just the page. Touch devices get a much cheaper look:
   position kept (still see the corner glows), no blur pass at all. The
   gradient's own fade-to-transparent stops still soften the edge. */

@media (hover: none) {
  .blob {
    filter: none;
  }
}

/* Anchored to the viewport corners (not the content column, which is
   fixed-width and centered) so only each blob's soft fade ever reaches the
   visible edge — never its saturated core — regardless of viewport width.
   Warm cluster top-right, cool anchor bottom-left: a deliberate diagonal
   instead of a symmetric mesh. Each drifts on its own slow, independent
   cycle, never tied to the cursor. */

.blob-yellow {
  width: min(50vw, 720px);
  height: min(50vw, 720px);
  left: 100%;
  top: -10%;
  background: radial-gradient(circle, #ffd166 0%, #ff9a3c 32%, transparent 60%);
  opacity: 0.42;
  animation: drift-yellow 34s ease-in-out infinite;
}

.blob-red {
  width: min(44vw, 620px);
  height: min(44vw, 620px);
  left: 82%;
  top: 18%;
  background: radial-gradient(circle, #e1432d 0%, #a82c19 34%, transparent 62%);
  opacity: 0.36;
  animation: drift-red 28s ease-in-out infinite;
}

.blob-teal {
  width: min(44vw, 640px);
  height: min(44vw, 640px);
  left: -5%;
  top: 95%;
  background: radial-gradient(circle, #12b58a 0%, #4f46e5 40%, transparent 65%);
  opacity: 0.42;
  animation: drift-teal 26s ease-in-out infinite;
}

@keyframes drift-yellow {
  0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
  50% { transform: translate(-50%, -50%) translate(-30px, 22px); }
}

@keyframes drift-red {
  0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
  50% { transform: translate(-50%, -50%) translate(26px, -20px); }
}

@keyframes drift-teal {
  0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
  50% { transform: translate(-50%, -50%) translate(24px, -18px); }
}

@media (prefers-reduced-motion: reduce) {
  .blob-yellow,
  .blob-red,
  .blob-teal {
    animation: none;
  }
}

/* Touch devices: `backdrop-filter` recomputed every frame behind three
   continuously animated, heavily-blurred shapes is one of the most
   expensive things a mobile GPU can be asked to do — it's the main cause
   of jank/lag on phones. Freeze the blobs in place and cut the blur radii
   way down; the mesh still shows through, it just stops animating. */

@media (hover: none) {
  .blob-yellow,
  .blob-red,
  .blob-teal {
    animation: none;
  }
}

/* Soft glow that trails the cursor — heavily damped and slow so quick
   mouse movement never looks sharp or jittery. Desktop pointers only. */

.cursor-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

.cursor-glow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 640px;
  height: 640px;
  margin: -320px 0 0 -320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 205, 150, 0.16) 0%, rgba(255, 154, 60, 0.06) 45%, transparent 72%);
  filter: blur(70px);
  transform: translate(var(--gx, 0px), var(--gy, 0px));
  transition: transform 1.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor-glow {
    display: none;
  }
}

/* Grain over the mesh for depth — a slow breathing scale/opacity keeps it
   from reading as a flat, static texture. */

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grain-breathe 9s ease-in-out infinite;
}

@keyframes grain-breathe {
  0%, 100% { opacity: 0.05; transform: scale(1) translate(0, 0); }
  50% { opacity: 0.09; transform: scale(1.04) translate(-1%, 1%); }
}

@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
    opacity: 0.06;
  }
}

@media (hover: none) {
  /* The SVG feTurbulence filter + mix-blend-mode combo on a fixed layer is
     itself a known source of severe scroll jank on iOS Safari — not just
     its animation. Drop the whole layer on touch instead of toning it
     down; it's a subtle texture, not worth the cost on a phone. */
  .grain {
    display: none;
  }
}

/* Vignette for cinematic depth — darkens the edges so the mesh feels less
   flat and draws focus toward the content panel. */

.vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, transparent 55%, rgba(0, 0, 0, 0.22) 100%);
}

/* Layout ------------------------------------------------------------- */

main {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  /* Frosted panel so body copy stays legible over the bright mesh */
  background: linear-gradient(180deg, rgba(13, 15, 18, 0.72), rgba(13, 15, 18, 0.86));
  backdrop-filter: blur(28px) saturate(1.15);
  -webkit-backdrop-filter: blur(28px) saturate(1.15);
}

/* Touch devices: iOS Safari in particular can end up recomputing
   backdrop-filter on every scroll frame for a fixed/sticky ancestor setup
   like this one, which drags down the whole browser, not just the page.
   Drop it entirely on touch and fall back to a near-opaque solid panel —
   still dark, still legible, just a flat background instead of a blur. */
@media (hover: none) {
  main {
    background: rgb(13, 15, 18);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

section {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-number {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-1);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

/* Hero ----------------------------------------------------------------- */

#hero {
  padding-top: 120px;
  padding-bottom: 80px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
  opacity: 0;
  animation: hero-fade-in 0.7s ease-out 0.05s forwards;
}

.hero-photo {
  position: relative;
  flex-shrink: 0;
  width: 136px;
  height: 175px;
  border-radius: 20px;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
}

.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  object-fit: cover;
  background: var(--bg);
}

.hero-photo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  font-size: 1.4rem;
}

.hero-photo.photo-fallback img {
  display: none;
}

.hero-photo.photo-fallback .hero-photo-fallback {
  display: flex;
}

.hero-text {
  min-width: 0;
}

.hero-name {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero-headline {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.25;
  max-width: 20ch;
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  opacity: 0;
  animation: hero-fade-in 0.7s ease-out 0.1s forwards;
}

.highlight-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(237, 237, 236, 0.03);
  font-size: 0.85rem;
  font-weight: 500;
}

.hero-summary {
  color: var(--muted);
  max-width: 58ch;
  font-size: 1.05rem;
  margin-bottom: 12px;
  opacity: 0;
  animation: hero-fade-in 0.7s ease-out 0.15s forwards;
}

.hero-meta {
  color: var(--muted);
  font-size: 0.95rem;
  opacity: 0;
  animation: hero-fade-in 0.7s ease-out 0.25s forwards;
}

.resume-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 12px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  animation: hero-fade-in 0.7s ease-out 0.35s forwards;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.resume-link svg {
  width: 16px;
  height: 16px;
}

.resume-link:hover,
.resume-link:focus-visible {
  border-color: var(--accent-1);
  background: rgba(237, 237, 236, 0.05);
  transform: translateY(-1px);
}

@keyframes hero-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-top,
  .hero-highlights,
  .hero-summary,
  .hero-meta,
  .resume-link {
    animation: none;
    opacity: 1;
  }
}

@media (max-width: 560px) {
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .hero-photo {
    width: 112px;
    height: 144px;
  }
}

/* Experience ------------------------------------------------------------ */

#experience h2 {
  font-size: 1.4rem;
  margin-bottom: 48px;
}

.timeline {
  position: relative;
  list-style: none;
  padding-left: 28px;
  margin: 0;
  border-left: 1px solid var(--border-strong);
}

.timeline-item {
  position: relative;
  margin-bottom: 56px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-role {
  position: relative;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-role::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-1);
}

.timeline-company {
  color: var(--fg);
  font-weight: 500;
}

.timeline-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 6px 0 16px;
}

.timeline-description {
  margin-bottom: 14px;
  max-width: 62ch;
}

.timeline-points {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.timeline-points strong {
  color: var(--fg);
  font-weight: 600;
}

.timeline-points li {
  margin-bottom: 8px;
  max-width: 62ch;
}

.timeline-points li::marker {
  color: var(--border-strong);
}

/* Scroll reveal ------------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal-visible {
  animation: reveal-in 0.5s ease calc(var(--i, 0) * 70ms) forwards;
}

@keyframes reveal-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }

  .reveal-visible {
    animation: none;
  }
}

/* Projects ----------------------------------------------------------------- */

#projects h2 {
  font-size: 1.4rem;
  margin-bottom: 48px;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.project-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(237, 237, 236, 0.02);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  background: rgba(237, 237, 236, 0.04);
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.project-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.project-period {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.project-description {
  color: var(--muted);
  max-width: 62ch;
  margin-bottom: 12px;
}

.project-stack {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.project-link {
  color: var(--accent-1);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.project-link:hover {
  text-decoration: underline;
}

.projects-empty {
  color: var(--muted);
  font-style: italic;
}

/* Stack ------------------------------------------------------------------ */

#stack h2 {
  font-size: 1.4rem;
  margin-bottom: 48px;
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 40px;
}

.stack-group-title {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(237, 237, 236, 0.03);
  font-size: 0.88rem;
}

/* Contact ------------------------------------------------------------------ */

#contact h2 {
  font-size: 1.4rem;
  margin-bottom: 32px;
}

.contact-group + .contact-group {
  margin-top: 28px;
}

.contact-group-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.contact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(237, 237, 236, 0.02);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.contact-row:hover,
.contact-row:focus-visible {
  border-color: var(--border-strong);
  background: rgba(237, 237, 236, 0.05);
  transform: translateY(-2px);
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(237, 237, 236, 0.06);
  color: var(--fg);
  transition: background 0.2s ease;
}

.contact-row:hover .contact-icon {
  background: rgba(237, 237, 236, 0.1);
}

.contact-icon svg {
  width: 18px;
  height: 18px;
}

.contact-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-label {
  font-weight: 600;
}

.contact-handle {
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.contact-row:hover .contact-arrow {
  transform: translate(2px, -2px);
  color: var(--fg);
}

footer {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--fg);
  text-decoration: underline;
}

/* Back to top ---------------------------------------------------------- */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(13, 15, 18, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s ease, background 0.2s ease;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  border-color: var(--accent-1);
  background: rgba(237, 237, 236, 0.08);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.15s ease;
    transform: none;
  }
}

@media (max-width: 560px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* Focus states ------------------------------------------------------------- */

a:focus-visible,
.back-to-top:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}

/* Responsive ---------------------------------------------------------------- */

@media (max-width: 560px) {
  section {
    padding: 64px 0;
  }

  #hero {
    padding-top: 72px;
  }

  .stack-grid {
    grid-template-columns: 1fr;
  }

  .contact-list {
    grid-template-columns: 1fr;
  }
}

/* Legal pages (Impressum, Datenschutzerklärung) ----------------------------- */

.legal-page {
  padding: 96px 0 64px;
}

.legal-back {
  display: inline-block;
  margin-bottom: 40px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.legal-back:hover {
  color: var(--fg);
}

.legal-page h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.legal-page .legal-updated {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 48px;
}

.legal-page h2 {
  font-size: 1.1rem;
  margin-top: 40px;
  margin-bottom: 12px;
}

.legal-page p {
  color: var(--muted);
  max-width: 68ch;
  margin-bottom: 12px;
}

.legal-page address {
  font-style: normal;
  color: var(--muted);
  margin-bottom: 12px;
}

.legal-page a {
  color: var(--fg);
}

.legal-page .legal-cross-link {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

@media (max-width: 560px) {
  .legal-page {
    padding: 64px 0 48px;
  }
}
