/* ========== Basis ========== */
:root {
  --navy: #0e2a3b;
  --sand: #f4f1ea;
  --red: #d9442b;
  --muted: #5d6c76;
  --line: rgba(14, 42, 59, .16);
  --pad: clamp(1.25rem, 5vw, 4rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --p: 0; /* Scroll-Fortschritt im Hero (0–1), gesetzt per JS */
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--navy);
  font: 400 1.0625rem/1.65 "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, .display {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.035em;
  margin: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
p { margin: 0 0 1em; }

.wrap { padding-inline: var(--pad); max-width: 90rem; margin-inline: auto; }

.label {
  font: 500 .75rem/1 "Space Grotesk", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label b { color: var(--red); font-weight: 500; }

/* ========== Navigation ========== */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) var(--pad) 1rem;
  transition: background .4s, backdrop-filter .4s;
}
.scrolled .nav {
  background: rgba(244, 241, 234, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font: 500 1rem "Space Grotesk", sans-serif;
}
.logo span { opacity: 0; transform: translateY(6px); transition: .4s var(--ease); }
.scrolled .logo span, .sub .logo span { opacity: 1; transform: none; }
.compass {
  width: 28px;
  height: 28px;
  transform: rotate(calc(var(--s, 0) * .25deg));
}
.nav ul { display: flex; gap: clamp(1rem, 3vw, 2.5rem); list-style: none; margin: 0; padding: 0; }
.nav ul a { position: relative; font-size: .9375rem; }
.nav ul a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .35s var(--ease);
}
.nav ul a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ========== Hero ========== */
.hero {
  min-height: 100svh;
  display: grid;
  align-content: end;
  padding-block: 7rem 0;
  overflow: hidden;
}
.hero-inner {
  transform: scale(calc(1 - var(--p) * .25));
  transform-origin: left bottom;
  opacity: calc(1 - var(--p) * 1.2);
}
.hero h1 {
  font-size: clamp(3.5rem, 13vw, 12rem);
  margin: 1.25rem 0 1.5rem;
}
.hero .tagline {
  max-width: 34rem;
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: var(--muted);
}
.hero .tagline em { font-style: normal; color: var(--navy); }

/* Buchstaben erscheinen nacheinander */
.js .split:not(.go) { opacity: 0; }
.split .word { display: inline-block; white-space: nowrap; }
.split .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(.4em);
  animation: rise .9s var(--ease) forwards;
  animation-delay: calc(var(--i) * 45ms + 150ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* Welle */
.waves {
  position: relative;
  height: clamp(70px, 12vw, 140px);
  margin-top: 3rem;
  transform: scaleY(calc(1 - var(--p) * .85));
  transform-origin: bottom;
}
.waves svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 100%;
  animation: drift 14s linear infinite;
}
.waves svg + svg { animation-duration: 22s; animation-direction: reverse; opacity: .9; }
@keyframes drift { to { transform: translateX(-50%); } }

/* ========== Sektionen ========== */
section { padding-block: clamp(5rem, 12vw, 10rem); }
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--line);
}
.sec-head h2 { font-size: clamp(2.25rem, 6vw, 4.5rem); }

/* ========== Projektliste ========== */
.work { list-style: none; margin: 0; padding: 0; }
.work li { border-bottom: 1px solid var(--line); }
.work a {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding-block: clamp(1.5rem, 3.5vw, 2.75rem);
  transition: color .3s, padding .4s var(--ease);
}
.work .num { font: 500 .875rem "Space Grotesk", sans-serif; color: var(--muted); }
.work h3 {
  font-size: clamp(1.875rem, 5.5vw, 4.25rem);
  transition: transform .5s var(--ease);
  transform-origin: left;
}
.work .meta { text-align: right; font-size: .875rem; color: var(--muted); }
.work .arrow {
  display: inline-block;
  color: var(--red);
  transition: transform .4s var(--ease);
}
.work a:hover h3 { transform: translateX(.6rem) scale(1.02); }
.work a:hover .arrow { transform: translateX(.4rem); }
.work a:hover .num { color: var(--red); }

/* Vorschau folgt dem Mauszeiger (nur Desktop) */
.preview {
  position: fixed;
  top: 0; left: 0;
  z-index: 5;
  width: clamp(240px, 24vw, 380px);
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  pointer-events: none;
  background: var(--bg, var(--navy)) center / cover;
  opacity: 0;
  scale: .85;
  transition: opacity .3s, scale .4s var(--ease);
}
.preview.on { opacity: 1; scale: 1; }
.work .work-thumb { display: none; }

@media (hover: none), (max-width: 760px) {
  .preview { display: none; }
  .work a { grid-template-columns: 1fr; gap: .5rem; }
  .work .meta { text-align: left; }
  .work .work-thumb {
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    margin-bottom: .75rem;
  }
}

/* ========== Über mich ========== */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.portrait {
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  transition: transform .6s var(--ease);
}
.portrait:hover { transform: scale(1.02); }
.lead {
  font: 400 clamp(1.5rem, 3vw, 2.375rem)/1.25 "Space Grotesk", sans-serif;
  letter-spacing: -.02em;
  margin-bottom: 2rem;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}
.facts h3 { font-size: 1rem; letter-spacing: 0; margin-bottom: .75rem; }
.facts ul { list-style: none; margin: 0; padding: 0; color: var(--muted); }
.facts li { padding-block: .3rem; border-bottom: 1px solid var(--line); }
.facts li small { float: right; }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .nav ul { gap: 1rem; }
  .nav ul a { font-size: .875rem; }
}

/* Laufband */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding-block: 1.25rem;
  white-space: nowrap;
}
.marquee div {
  display: inline-block;
  font: 500 clamp(1.5rem, 4vw, 3rem) "Space Grotesk", sans-serif;
  letter-spacing: -.02em;
  animation: drift 30s linear infinite;
}
.marquee i { font-style: normal; color: var(--red); margin-inline: 1.5rem; }

/* ========== Kontakt ========== */
.contact { text-align: center; }
.contact h2 { font-size: clamp(3rem, 11vw, 9.5rem); margin-block: 1.5rem 2.5rem; }
.contact h2 span { color: var(--red); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  padding: 1.1rem 2rem;
  border-radius: 999px;
  background: var(--navy);
  color: var(--sand);
  font: 500 1.0625rem "Space Grotesk", sans-serif;
  transition: background .3s, transform .3s var(--ease);
}
.btn:hover { background: var(--red); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-4px) rotate(-1.5deg); }
  75% { transform: translateY(2px) rotate(1.5deg); }
}
.socials { display: flex; justify-content: center; gap: 2rem; margin-top: 2.5rem; }
.socials a { color: var(--muted); transition: color .3s; }
.socials a:hover { color: var(--red); }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  font-size: .8125rem;
  color: var(--muted);
}

/* ========== Platzhalter-Bilder ========== */
/* Ersetzen durch <img src="..." alt="..."> mit gleicher Klasse */
.ph {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #16394e, var(--navy));
  color: rgba(244, 241, 234, .5);
  font: 500 .8125rem "Space Grotesk", sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ph.alt { background: linear-gradient(135deg, #e6dfd1, #d8cfbe); color: var(--muted); }
.ph.red { background: linear-gradient(135deg, #e0583f, var(--red)); }
img.ph { object-fit: cover; width: 100%; }

/* ========== Scroll-Effekte ========== */
/* Einblenden beim Reinscrollen */
.js .reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* Linien zeichnen sich von links */
.js .sec-head, .js .work li { background: linear-gradient(var(--line), var(--line)) left bottom / 0 1px no-repeat; border-color: transparent; transition: background-size 1.2s var(--ease); }
.js .sec-head.in, .js .work li.in { background-size: 100% 1px; }

/* Kleiner werden beim Rausscrollen (wo der Browser es kann) */
@supports (animation-timeline: view()) {
  .shrink {
    animation: shrink linear both;
    animation-timeline: view();
    animation-range: exit 0% exit 100%;
  }
  @keyframes shrink { to { transform: scale(.9); opacity: .3; } }
}

/* ========== Projektseiten ========== */
.case-hero { padding-block: 9rem 3rem; }
.case-hero h1 { font-size: clamp(3rem, 10vw, 8.5rem); margin-block: 1.5rem 2rem; }
.case-hero .intro { max-width: 44rem; font-size: clamp(1.125rem, 2vw, 1.375rem); color: var(--muted); }
.back { display: inline-flex; gap: .5rem; color: var(--muted); transition: color .3s, gap .3s; }
.back:hover { color: var(--red); gap: .9rem; }

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.5rem;
  padding-block: 2rem;
  border-block: 1px solid var(--line);
}
.case-meta dt { margin-bottom: .35rem; }
.case-meta dd { margin: 0; }

.cover { aspect-ratio: 16 / 9; border-radius: 6px; margin-block: clamp(2rem, 5vw, 4rem); overflow: hidden; }
.cover > * { width: 100%; height: 100%; transform: scale(1.12); transition: transform 1.6s var(--ease); }
.cover.in > * { transform: scale(1); }

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  padding-block: clamp(3rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}
.chapter h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); margin-top: .75rem; }
.chapter .body { max-width: 42rem; }
.chapter .ph { aspect-ratio: 16 / 10; border-radius: 6px; margin-block: 2rem; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.duo .ph { margin-block: 0; aspect-ratio: 3 / 4; }
@media (max-width: 760px) { .chapter { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 2rem; margin-top: 1.5rem; }
.stats strong { display: block; font: 500 clamp(2.5rem, 6vw, 4.5rem)/1 "Space Grotesk", sans-serif; letter-spacing: -.04em; color: var(--red); }
.stats span { color: var(--muted); font-size: .9375rem; }

.next {
  display: block;
  padding-block: clamp(4rem, 10vw, 8rem);
  border-top: 1px solid var(--line);
}
.next h2 { font-size: clamp(2.5rem, 9vw, 7.5rem); margin-top: 1rem; transition: color .3s, transform .5s var(--ease); transform-origin: left; }
.next:hover h2 { color: var(--red); transform: translateX(1rem); }

/* ========== Weniger Bewegung ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal, .split .ch { opacity: 1; transform: none; }
  .hero-inner, .waves, .compass { transform: none; opacity: 1; }
  html { scroll-behavior: auto; }
}
